]> git.mdlowis.com Git - proto/labwc.git/commitdiff
font: use PangoStyle enum
authorJohan Malm <jgm323@gmail.com>
Wed, 23 Apr 2025 19:03:14 +0000 (20:03 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Wed, 23 Apr 2025 19:20:29 +0000 (20:20 +0100)
include/common/font.h
src/common/font.c
src/config/rcxml.c

index c728d484bd6d94f9c8c073b73e24ce9244b4f65b..17d1181e437daf75acf2c8fafbfb2f0baa31c88c 100644 (file)
@@ -5,16 +5,10 @@
 
 struct lab_data_buffer;
 
-enum font_slant {
-       FONT_SLANT_NORMAL = 0,
-       FONT_SLANT_ITALIC,
-       FONT_SLANT_OBLIQUE
-};
-
 struct font {
        char *name;
        int size;
-       enum font_slant slant;
+       PangoStyle slant;
        PangoWeight weight;
 };
 
index 5616c61bc0a279d3e2cbda36f7e35b630f3de518..d21734675fc5c82a218a2b0a7d1ef42f455425ad 100644 (file)
@@ -17,12 +17,7 @@ font_to_pango_desc(struct font *font)
        PangoFontDescription *desc = pango_font_description_new();
        pango_font_description_set_family(desc, font->name);
        pango_font_description_set_size(desc, font->size * PANGO_SCALE);
-       if (font->slant == FONT_SLANT_ITALIC) {
-               pango_font_description_set_style(desc, PANGO_STYLE_ITALIC);
-       }
-       if (font->slant == FONT_SLANT_OBLIQUE) {
-               pango_font_description_set_style(desc, PANGO_STYLE_OBLIQUE);
-       }
+       pango_font_description_set_style(desc, font->slant);
        pango_font_description_set_weight(desc, font->weight);
        return desc;
 }
index 1c72744aa27003f7e46167906af63ef85097b770..96ba6e2717e820e8ece426593c1d525da16ab6e2 100644 (file)
@@ -855,11 +855,11 @@ set_font_attr(struct font *font, const char *nodename, const char *content)
                font->size = atoi(content);
        } else if (!strcmp(nodename, "slant")) {
                if (!strcasecmp(content, "italic")) {
-                       font->slant = FONT_SLANT_ITALIC;
+                       font->slant = PANGO_STYLE_ITALIC;
                } else if (!strcasecmp(content, "oblique")) {
-                       font->slant = FONT_SLANT_OBLIQUE;
+                       font->slant = PANGO_STYLE_OBLIQUE;
                } else {
-                       font->slant = FONT_SLANT_NORMAL;
+                       font->slant = PANGO_STYLE_NORMAL;
                }
        } else if (!strcmp(nodename, "weight")) {
                if (!strcasecmp(content, "thin")) {
@@ -1474,7 +1474,7 @@ static void
 init_font_defaults(struct font *font)
 {
        font->size = 10;
-       font->slant = FONT_SLANT_NORMAL;
+       font->slant = PANGO_STYLE_NORMAL;
        font->weight = PANGO_WEIGHT_NORMAL;
 }