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.
Commit
08fe2bdc0d0d17853d5c32cf07f0f37f959414553c9017f29e12658cf88fb822
Parent
66851cd6bc9091f…
2 files changed
+19
-4
+2
+19
-4
| --- src/markdown_html.c | ||
| +++ src/markdown_html.c | ||
| @@ -347,11 +347,12 @@ | ||
| 347 | 347 | int pikFlags = PIKCHR_PROCESS_NONCE |
| 348 | 348 | | PIKCHR_PROCESS_DIV |
| 349 | 349 | | PIKCHR_PROCESS_SRC |
| 350 | 350 | | PIKCHR_PROCESS_ERR_PRE; |
| 351 | 351 | Blob bSrc = empty_blob; |
| 352 | - const char *zFgColor; | |
| 352 | + const char *zPikVar; | |
| 353 | + double rPikVar; | |
| 353 | 354 | |
| 354 | 355 | while( nArg>0 ){ |
| 355 | 356 | int i; |
| 356 | 357 | for(i=0; i<nArg && !fossil_isspace(zArg[i]); i++){} |
| 357 | 358 | if( i==6 && strncmp(zArg, "center", 6)==0 ){ |
| @@ -374,13 +375,27 @@ | ||
| 374 | 375 | nArg -= i; |
| 375 | 376 | } |
| 376 | 377 | if( skin_detail_boolean("white-foreground") ){ |
| 377 | 378 | pikFlags |= 0x02; /* PIKCHR_DARK_MODE */ |
| 378 | 379 | } |
| 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); | |
| 382 | 397 | } |
| 383 | 398 | blob_append(&bSrc, zSrc, nSrc) |
| 384 | 399 | /*have to dup input to ensure a NUL-terminated source string */; |
| 385 | 400 | pikchr_process(blob_str(&bSrc), pikFlags, 0, ob); |
| 386 | 401 | blob_reset(&bSrc); |
| 387 | 402 |
| --- 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 |
+2
| --- src/skins.c | ||
| +++ src/skins.c | ||
| @@ -85,11 +85,13 @@ | ||
| 85 | 85 | */ |
| 86 | 86 | static struct SkinDetail { |
| 87 | 87 | const char *zName; /* Name of the detail */ |
| 88 | 88 | const char *zValue; /* Value of the detail */ |
| 89 | 89 | } aSkinDetail[] = { |
| 90 | + { "pikchr-fontscale", "" }, | |
| 90 | 91 | { "pikchr-foreground", "" }, |
| 92 | + { "pikchr-scale", "" }, | |
| 91 | 93 | { "timeline-arrowheads", "1" }, |
| 92 | 94 | { "timeline-circle-nodes", "0" }, |
| 93 | 95 | { "timeline-color-graph-lines", "0" }, |
| 94 | 96 | { "white-foreground", "0" }, |
| 95 | 97 | }; |
| 96 | 98 |
| --- 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 |