/* Chrysalide - Outil d'analyse de fichiers binaires * tokenstyle-int.h - définitions internes propres à la centralisation des paramètres de rendu de bribes textuelles * * Copyright (C) 2024 Cyrille Bagard * * This file is part of Chrysalide. * * Chrysalide is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Chrysalide is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Chrysalide. If not, see . */ #ifndef _GLIBEXT_TOKENSTYLE_INT_H #define _GLIBEXT_TOKENSTYLE_INT_H #include "tokenstyle.h" #include /* Valeurs principales par défaut */ #define DEFAULT_FONT_FAMILY "cairo:monospace" #define DEFAULT_FONT_SIZE 14 /* Condensé de propriétés de Cairo */ #define CAIRO_FONT_SLANT_COUNT 3 #define CAIRO_FONT_WEIGHT_COUNT 2 #define CAIRO_FONTS_COUNT (CAIRO_FONT_SLANT_COUNT * CAIRO_FONT_WEIGHT_COUNT) #define CAIRO_FONT_INDEX(s, w) ((s) + (w) * CAIRO_FONT_WEIGHT_COUNT) /* Restitution d'un élément de thème pour bribe de texte */ typedef struct _rendering_property_t { GdkRGBA foreground; /* Couleur d'impression */ GdkRGBA inverted; /* Couleur inversée pour sél. */ cairo_font_slant_t slant; /* Style d'impression */ cairo_font_weight_t weight; /* Poids de la police */ } rendering_property_t; /* Centralisation de paramètres de rendu (instance) */ struct _GTokenStyle { GObject parent; /* A laisser en premier */ GtkWidget *target; /* Composant ciblé */ bool loaded; /* Validité des paramètres */ char *font_family; /* Désignation de la police */ int font_size; /* Taille de police choisie */ cairo_font_extents_t font_extents; /* Dimensions de la police */ double x_advances[CAIRO_FONTS_COUNT]; /* Largeurs par caractère */ rendering_property_t properties[TRT_COUNT]; /* Modèles d'impression */ }; /* Centralisation de paramètres de rendu (classe) */ struct _GTokenStyleClass { GObjectClass parent; /* A laisser en premier */ }; /* Met en place un nouveau gestionnaire de rendu des lignes. */ bool g_token_style_create(GTokenStyle *, GtkWidget *); #endif /* _GLIBEXT_TOKENSTYLE_INT_H */