Mercurial > dwindows
comparison gtk3/dw.c @ 2259:5f1677cc32e9
GTK3: Switch back to Pango syntax for older GTK versions.
The GTK 3.19 change notes indicate every widget was converted to CSS.
So enabling CSS support for 3.20 or higher... may need further testing
to be sure about the version support.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 27 Jan 2021 01:27:46 +0000 |
parents | 4fb54b9fcf78 |
children | cb24daa675a2 |
comparison
equal
deleted
inserted
replaced
2258:7cd64f66f1cc | 2259:5f1677cc32e9 |
---|---|
2685 | 2685 |
2686 if(oldfont) | 2686 if(oldfont) |
2687 free(oldfont); | 2687 free(oldfont); |
2688 } | 2688 } |
2689 | 2689 |
2690 /* Convert DW style font to CSS syntax: | 2690 /* Convert DW style font to CSS syntax (or Pango for older versions): |
2691 * font: font-style font-variant font-weight font-size/line-height font-family | 2691 * font: font-style font-variant font-weight font-size/line-height font-family |
2692 */ | 2692 */ |
2693 char *_convert_font(const char *font) | 2693 char *_convert_font(const char *font) |
2694 { | 2694 { |
2695 char *newfont = NULL; | 2695 char *newfont = NULL; |
2696 | 2696 |
2697 if(font) | 2697 if(font) |
2698 { | 2698 { |
2699 char *name = strchr(font, '.'); | 2699 char *name = strchr(font, '.'); |
2700 #if GTK_CHECK_VERSION(3,20,0) | |
2700 char *Italic = strstr(font, " Italic"); | 2701 char *Italic = strstr(font, " Italic"); |
2701 char *Bold = strstr(font, " Bold"); | 2702 char *Bold = strstr(font, " Bold"); |
2703 #endif | |
2702 | 2704 |
2703 /* Detect Dynamic Windows style font name... | 2705 /* Detect Dynamic Windows style font name... |
2704 * Format: ##.Fontname | 2706 * Format: ##.Fontname |
2705 * and convert to a Pango name | 2707 * and convert to CSS or Pango syntax |
2706 */ | 2708 */ |
2707 if(name && (name++) && isdigit(*font)) | 2709 if(name && (name++) && isdigit(*font)) |
2708 { | 2710 { |
2709 int size = atoi(font); | 2711 int size = atoi(font); |
2710 newfont = g_strdup_printf("%s normal %s %dpx %s", Italic ? "italic " : "normal", | 2712 #if GTK_CHECK_VERSION(3,20,0) |
2713 newfont = g_strdup_printf("%s normal %s %dpx \"%s\"", Italic ? "italic " : "normal", | |
2711 Bold ? "bold " : "normal", size, name); | 2714 Bold ? "bold " : "normal", size, name); |
2715 #else | |
2716 newfont = g_strdup_printf("%s %d", name, size); | |
2717 #endif | |
2712 } | 2718 } |
2713 } | 2719 } |
2714 return newfont; | 2720 return newfont; |
2715 } | 2721 } |
2716 | 2722 |