diff options
Diffstat (limited to 'src/glibext/tokenstyle-int.h')
-rw-r--r-- | src/glibext/tokenstyle-int.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/glibext/tokenstyle-int.h b/src/glibext/tokenstyle-int.h new file mode 100644 index 0000000..9cf4df2 --- /dev/null +++ b/src/glibext/tokenstyle-int.h @@ -0,0 +1,94 @@ + +/* 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 <http://www.gnu.org/licenses/>. + */ + + +#ifndef _GLIBEXT_TOKENSTYLE_INT_H +#define _GLIBEXT_TOKENSTYLE_INT_H + + +#include "tokenstyle.h" + + +#include <stdbool.h> + + + +/* 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 */ |