Fossil SCM

Add support for the pikchr-scale and pikchr-fontscale variables in the details.txt of skins. Use these values to adjust the sizes of Pikchr images to better match alternative font sizes in the skin.

drh 2020-11-22 12:35 trunk
Commit 08fe2bdc0d0d17853d5c32cf07f0f37f959414553c9017f29e12658cf88fb822
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -347,11 +347,12 @@
347347
int pikFlags = PIKCHR_PROCESS_NONCE
348348
| PIKCHR_PROCESS_DIV
349349
| PIKCHR_PROCESS_SRC
350350
| PIKCHR_PROCESS_ERR_PRE;
351351
Blob bSrc = empty_blob;
352
- const char *zFgColor;
352
+ const char *zPikVar;
353
+ double rPikVar;
353354
354355
while( nArg>0 ){
355356
int i;
356357
for(i=0; i<nArg && !fossil_isspace(zArg[i]); i++){}
357358
if( i==6 && strncmp(zArg, "center", 6)==0 ){
@@ -374,13 +375,27 @@
374375
nArg -= i;
375376
}
376377
if( skin_detail_boolean("white-foreground") ){
377378
pikFlags |= 0x02; /* PIKCHR_DARK_MODE */
378379
}
379
- zFgColor = skin_detail("pikchr-foreground");
380
- if( zFgColor && zFgColor[0] ){
381
- blob_appendf(&bSrc, "fgcolor = %s\n", zFgColor);
380
+ zPikVar = skin_detail("pikchr-foreground");
381
+ if( zPikVar && zPikVar[0] ){
382
+ blob_appendf(&bSrc, "fgcolor = %s\n", zPikVar);
383
+ }
384
+ zPikVar = skin_detail("pikchr-scale");
385
+ if( zPikVar
386
+ && (rPikVar = atof(zPikVar))>=0.1
387
+ && rPikVar<10.0
388
+ ){
389
+ blob_appendf(&bSrc, "scale = %.13g\n", rPikVar);
390
+ }
391
+ zPikVar = skin_detail("pikchr-fontscale");
392
+ if( zPikVar
393
+ && (rPikVar = atof(zPikVar))>=0.1
394
+ && rPikVar<10.0
395
+ ){
396
+ blob_appendf(&bSrc, "fontscale = %.13g\n", rPikVar);
382397
}
383398
blob_append(&bSrc, zSrc, nSrc)
384399
/*have to dup input to ensure a NUL-terminated source string */;
385400
pikchr_process(blob_str(&bSrc), pikFlags, 0, ob);
386401
blob_reset(&bSrc);
387402
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -347,11 +347,12 @@
347 int pikFlags = PIKCHR_PROCESS_NONCE
348 | PIKCHR_PROCESS_DIV
349 | PIKCHR_PROCESS_SRC
350 | PIKCHR_PROCESS_ERR_PRE;
351 Blob bSrc = empty_blob;
352 const char *zFgColor;
 
353
354 while( nArg>0 ){
355 int i;
356 for(i=0; i<nArg && !fossil_isspace(zArg[i]); i++){}
357 if( i==6 && strncmp(zArg, "center", 6)==0 ){
@@ -374,13 +375,27 @@
374 nArg -= i;
375 }
376 if( skin_detail_boolean("white-foreground") ){
377 pikFlags |= 0x02; /* PIKCHR_DARK_MODE */
378 }
379 zFgColor = skin_detail("pikchr-foreground");
380 if( zFgColor && zFgColor[0] ){
381 blob_appendf(&bSrc, "fgcolor = %s\n", zFgColor);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382 }
383 blob_append(&bSrc, zSrc, nSrc)
384 /*have to dup input to ensure a NUL-terminated source string */;
385 pikchr_process(blob_str(&bSrc), pikFlags, 0, ob);
386 blob_reset(&bSrc);
387
--- src/markdown_html.c
+++ src/markdown_html.c
@@ -347,11 +347,12 @@
347 int pikFlags = PIKCHR_PROCESS_NONCE
348 | PIKCHR_PROCESS_DIV
349 | PIKCHR_PROCESS_SRC
350 | PIKCHR_PROCESS_ERR_PRE;
351 Blob bSrc = empty_blob;
352 const char *zPikVar;
353 double rPikVar;
354
355 while( nArg>0 ){
356 int i;
357 for(i=0; i<nArg && !fossil_isspace(zArg[i]); i++){}
358 if( i==6 && strncmp(zArg, "center", 6)==0 ){
@@ -374,13 +375,27 @@
375 nArg -= i;
376 }
377 if( skin_detail_boolean("white-foreground") ){
378 pikFlags |= 0x02; /* PIKCHR_DARK_MODE */
379 }
380 zPikVar = skin_detail("pikchr-foreground");
381 if( zPikVar && zPikVar[0] ){
382 blob_appendf(&bSrc, "fgcolor = %s\n", zPikVar);
383 }
384 zPikVar = skin_detail("pikchr-scale");
385 if( zPikVar
386 && (rPikVar = atof(zPikVar))>=0.1
387 && rPikVar<10.0
388 ){
389 blob_appendf(&bSrc, "scale = %.13g\n", rPikVar);
390 }
391 zPikVar = skin_detail("pikchr-fontscale");
392 if( zPikVar
393 && (rPikVar = atof(zPikVar))>=0.1
394 && rPikVar<10.0
395 ){
396 blob_appendf(&bSrc, "fontscale = %.13g\n", rPikVar);
397 }
398 blob_append(&bSrc, zSrc, nSrc)
399 /*have to dup input to ensure a NUL-terminated source string */;
400 pikchr_process(blob_str(&bSrc), pikFlags, 0, ob);
401 blob_reset(&bSrc);
402
--- src/skins.c
+++ src/skins.c
@@ -85,11 +85,13 @@
8585
*/
8686
static struct SkinDetail {
8787
const char *zName; /* Name of the detail */
8888
const char *zValue; /* Value of the detail */
8989
} aSkinDetail[] = {
90
+ { "pikchr-fontscale", "" },
9091
{ "pikchr-foreground", "" },
92
+ { "pikchr-scale", "" },
9193
{ "timeline-arrowheads", "1" },
9294
{ "timeline-circle-nodes", "0" },
9395
{ "timeline-color-graph-lines", "0" },
9496
{ "white-foreground", "0" },
9597
};
9698
--- src/skins.c
+++ src/skins.c
@@ -85,11 +85,13 @@
85 */
86 static struct SkinDetail {
87 const char *zName; /* Name of the detail */
88 const char *zValue; /* Value of the detail */
89 } aSkinDetail[] = {
 
90 { "pikchr-foreground", "" },
 
91 { "timeline-arrowheads", "1" },
92 { "timeline-circle-nodes", "0" },
93 { "timeline-color-graph-lines", "0" },
94 { "white-foreground", "0" },
95 };
96
--- src/skins.c
+++ src/skins.c
@@ -85,11 +85,13 @@
85 */
86 static struct SkinDetail {
87 const char *zName; /* Name of the detail */
88 const char *zValue; /* Value of the detail */
89 } aSkinDetail[] = {
90 { "pikchr-fontscale", "" },
91 { "pikchr-foreground", "" },
92 { "pikchr-scale", "" },
93 { "timeline-arrowheads", "1" },
94 { "timeline-circle-nodes", "0" },
95 { "timeline-color-graph-lines", "0" },
96 { "white-foreground", "0" },
97 };
98

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button