diff options
Diffstat (limited to 'src/glibext')
| -rw-r--r-- | src/glibext/Makefile.am | 1 | ||||
| -rw-r--r-- | src/glibext/gbufferline.c | 23 | ||||
| -rw-r--r-- | src/glibext/gbufferline.h | 39 | ||||
| -rw-r--r-- | src/glibext/gbuffersegment.c | 524 | ||||
| -rw-r--r-- | src/glibext/gbuffersegment.h | 44 | ||||
| -rw-r--r-- | src/glibext/gcodebuffer.c | 6 | ||||
| -rw-r--r-- | src/glibext/gfontcache.c | 294 | ||||
| -rw-r--r-- | src/glibext/gfontcache.h | 79 | 
8 files changed, 237 insertions, 773 deletions
diff --git a/src/glibext/Makefile.am b/src/glibext/Makefile.am index e5c1a46..f7f3da3 100644 --- a/src/glibext/Makefile.am +++ b/src/glibext/Makefile.am @@ -11,7 +11,6 @@ libglibext_la_SOURCES =					\  	gbufferline.h gbufferline.c			\  	gbuffersegment.h gbuffersegment.c	\  	gcodebuffer.h gcodebuffer.c			\ -	gfontcache.h gfontcache.c			\  	gnhash.h gnhash.c					\  	proto.h diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c index 18f8a2a..907b5bd 100644 --- a/src/glibext/gbufferline.c +++ b/src/glibext/gbufferline.c @@ -67,7 +67,7 @@ static GBufferSegment *get_segment_at(const buffer_line_column *, gint *, bool);  GSList *highlight_all_same_segments(const buffer_line_column *, GSList *, const GBufferSegment *);  /* Imprime le contenu d'une colonne de ligne de texte. */ -static void draw_segments_of_column(buffer_line_column *, cairo_t *, GFontCache *, gint, gint); +static void draw_segments_of_column(buffer_line_column *, cairo_t *, gint, gint); @@ -86,6 +86,8 @@ struct _GBufferLine      BufferLineColumn merge_start;           /* Début de la zone globale    */      BufferLineColumn last_used;             /* Dernière colonne utilisée   */ +    cairo_surface_t *bookmark_img;          /* Image pour les signets      */ +  };  /* Représentation de fragments de texte en ligne (classe) */ @@ -265,7 +267,6 @@ GSList *highlight_all_same_segments(const buffer_line_column *column, GSList *li  *                                                                             *  *  Paramètres  : column = colonne de ligne de texte à manipuler.              *  *                cairo  = contexte graphique à utiliser pour les pinceaux.    * -*                fcache = gestionnaire des polices pour l'impression.         *  *                x_init = abscisse du point d'impression de départ.           *  *                y      = ordonnée du point d'impression.                     *  *                                                                             * @@ -277,7 +278,7 @@ GSList *highlight_all_same_segments(const buffer_line_column *column, GSList *li  *                                                                             *  ******************************************************************************/ -static void draw_segments_of_column(buffer_line_column *column, cairo_t *cairo, GFontCache *fcache, gint x_init, gint y) +static void draw_segments_of_column(buffer_line_column *column, cairo_t *cairo, gint x_init, gint y)  {      gint x;      size_t i; @@ -285,7 +286,7 @@ static void draw_segments_of_column(buffer_line_column *column, cairo_t *cairo,      x = x_init;      for (i = 0; i < column->count; i++) -        g_buffer_segment_draw(column->segments[i], cairo, fcache, &x, y); +        g_buffer_segment_draw(column->segments[i], cairo, &x, y);  } @@ -472,6 +473,7 @@ static void g_buffer_line_class_init(GBufferLineClass *class)  static void g_buffer_line_init(GBufferLine *line)  {      BufferLineColumn i;                     /* Boucle de parcours          */ +    char *filename;                         /* Chemin d'accès à utiliser   */      for (i = BLC_ADDRESS; i < BLC_COUNT; i++)          reset_column(&line->columns[i]); @@ -479,6 +481,9 @@ static void g_buffer_line_init(GBufferLine *line)      line->merge_start = BLC_COUNT;      line->last_used = BLC_COUNT; +    filename = "/home/ocb/prog/chrysalide.cdb/pixmaps/bookmark.png"; +    line->bookmark_img = cairo_image_surface_create_from_png(filename); +  } @@ -684,7 +689,7 @@ void g_buffer_line_insert_text(GBufferLine *line, BufferLineColumn column, const      class = G_BUFFER_LINE_GET_CLASS(line); -    segment = g_buffer_segment_new(class->attribs[type], text, length); +    segment = g_buffer_segment_new(type, text, length);      g_buffer_line_add_segment(line, column, segment);  } @@ -808,7 +813,6 @@ void g_buffer_line_start_merge_at(GBufferLine *line, BufferLineColumn start)  *                                                                             *  *  Paramètres  : line       = ligne de texte à manipuler.                     *  *                cairo      = contexte graphique à utiliser pour les pinceaux.* -*                fcache     = gestionnaire des polices pour l'impression.     *  *                max_widths = largeurs de colonne à respecter.                *  *                x_init     = abscisse du point d'impression de départ.       *  *                y          = ordonnée du point d'impression.                 * @@ -823,11 +827,14 @@ void g_buffer_line_start_merge_at(GBufferLine *line, BufferLineColumn start)  *                                                                             *  ******************************************************************************/ -void g_buffer_line_draw(GBufferLine *line, cairo_t *cairo, GFontCache *fcache, const gint max_widths[BLC_COUNT], gint x_init, gint y, bool addr, bool code) +void g_buffer_line_draw(GBufferLine *line, cairo_t *cairo, const gint max_widths[BLC_COUNT], gint x_init, gint y, bool addr, bool code)  {      gint x;                                 /* Point de départ d'impression*/      BufferLineColumn i;                     /* Boucle de parcours          */ +    cairo_set_source_surface(cairo, line->bookmark_img, 5, y); +    cairo_paint(cairo); +      x = x_init;      for (i = BLC_ADDRESS; i < BLC_COUNT; i++) @@ -835,7 +842,7 @@ void g_buffer_line_draw(GBufferLine *line, cairo_t *cairo, GFontCache *fcache, c          if (i == BLC_ADDRESS && !addr) continue;          if (i == BLC_BINARY && !code) continue; -        draw_segments_of_column(&line->columns[i], cairo, fcache, x, y); +        draw_segments_of_column(&line->columns[i], cairo, x, y);          if (i < line->merge_start)              x += max_widths[i] + COL_MARGIN; diff --git a/src/glibext/gbufferline.h b/src/glibext/gbufferline.h index 7b063ac..cf8ecf4 100644 --- a/src/glibext/gbufferline.h +++ b/src/glibext/gbufferline.h @@ -67,43 +67,6 @@ typedef enum _BufferLineColumn  } BufferLineColumn; -/* Types de partie de rendu */ -typedef enum _RenderingTagType -{ -    RTT_RAW,                                /* Contenu brut                */ - -    RTT_COMMENT,                            /* Commentaire                 */ -    RTT_INDICATION,                         /* Aide à la lecture           */ -    RTT_RAW_CODE,                           /* Code binaire brut           */ - -    RTT_INSTRUCTION,                        /* Code binaire brut           */ - -    RTT_IMMEDIATE,                          /* Valeur immédiate            */ - -    RTT_REGISTER,                           /* Registre                    */ - -    RTT_PUNCT,                              /* Signes de ponctuation       */ -    RTT_HOOK,                               /* Crochets '[' et ']'         */ -    RTT_SIGNS,                              /* Signes '+', '-' et '*'      */ -    RTT_LTGT,                               /* Caractères '<' et '>'       */ - -    RTT_SECTION,                            /* Identifiant de section      */ -    RTT_SEGMENT,                            /* Indication de segment       */ -    RTT_STRING,                             /* Chaîne de caractères avec " */ - -    RTT_VAR_NAME,                           /* Nom de variable             */ - -    RTT_KEY_WORD,                           /* Mot clef de langage         */ - -    RTT_ERROR,                              /* Erreur "interne"            */ - -    RTT_COUNT - -} RenderingTagType; - - -#define RTT_NONE RTT_RAW    /* TODO : remme */ -  /* Confort pour l'insertion de texte */ @@ -151,7 +114,7 @@ gint g_buffer_line_get_merge_width(GBufferLine *, BufferLineColumn *, bool, bool  void g_buffer_line_start_merge_at(GBufferLine *, BufferLineColumn);  /* Imprime la ligne de texte représentée. */ -void g_buffer_line_draw(GBufferLine *, cairo_t *, GFontCache *, const gint [BLC_COUNT], gint, gint, bool, bool); +void g_buffer_line_draw(GBufferLine *, cairo_t *, const gint [BLC_COUNT], gint, gint, bool, bool);  /* Exporte la ligne de texte représentée. */  void g_buffer_line_export(GBufferLine *, int, BufferExportType, bool, bool, bool); diff --git a/src/glibext/gbuffersegment.c b/src/glibext/gbuffersegment.c index 31f1840..df20887 100644 --- a/src/glibext/gbuffersegment.c +++ b/src/glibext/gbuffersegment.c @@ -25,10 +25,13 @@  #include <stdbool.h> +#include <stdlib.h>  #include <string.h>  #include "../common/fnv1a.h" +#include "../gtkext/gtkblockview.h" +#include "../gtkext/support.h" @@ -36,6 +39,23 @@  #define COLOR_NOT_SET   0  #define COLOR_SET       1 +/* Propriétés de rendu */ +typedef struct _rendering_pattern_t +{ +    GdkColor foreground;                    /* Couleur d'impression        */ + +    cairo_font_slant_t slant;               /* Style d'impression          */ +    cairo_font_weight_t weight;             /* Poids de la police          */ + +} rendering_pattern_t; + +/* Compléments à 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) * CAIRO_FONT_SLANT_COUNT + (w))  /* Fragment de caractères aux propriétés communes (instance) */  struct _GBufferSegment @@ -45,19 +65,15 @@ struct _GBufferSegment      char *text;                             /* Texte brut conservé         */      fnv64_t hash;                           /* Empreinte pour comparaisons */ -    PangoAttrList *attribs;                 /* Propriétés du rendu         */ +    rendering_pattern_t *pattern;           /* Propriétés du rendu         */      SegRenderingStyle style;                /* Apparence du segment        */      GdkColor cache_bg;                      /* Fond d'impression           */ -    GdkColor cache_fg;                      /* Couleur d'impression #1     */ -    GdkColor cache_alt_fg;                  /* Couleur d'impression #2     */ -    GdkColor *cache_used_fg;                /* Couleur d'impression utile  */ - -    PangoGlyphString *glyphs;               /* Caractères traités          */ -    PangoFontDescription *desc;             /* Description de police       */ +    GdkColor alt_fg;                        /* Couleur d'impression bis    */ +    GdkColor *used_fg;                      /* Couleur d'impression utile  */ -    PangoRectangle logical;                 /* Dimension du texte          */ +    cairo_text_extents_t extents;           /* Dimensions du texte         */  }; @@ -66,11 +82,8 @@ struct _GBufferSegmentClass  {      GObjectClass parent;                    /* A laisser en premier        */ -    PangoGlyphString *ascii_glyphs;         /* Caractères ASCII prêts      */ -    PangoFont *ascii_font;                  /* Police utilisée pour ASCII  */ -    bool ascii_ready;                       /* Utilisation possible ?      */ - -    bool ascii_init_done;                   /* Initialisation tentée ?     */ +    cairo_t *font_ctxts[CAIRO_FONTS_COUNT]; /* Contextes de police         */ +    rendering_pattern_t patterns[RTT_COUNT];/* Modèles d'impression        */  }; @@ -81,270 +94,117 @@ static void g_buffer_segment_class_init(GBufferSegmentClass *);  /* Procède à l'initialisation d'un fragment de texte. */  static void g_buffer_segment_init(GBufferSegment *); +/* Définit les dernières propriétés de rendu restantes. */ +static void g_buffer_segment_prepare(GBufferSegment *, const char *); - - - - - - -static bool ascii_glyph_table_init(GBufferSegmentClass *class, PangoContext *context) -{ -    gint i;                                 /* Boucle de parcours          */ -    char ascii_chars[128];                  /* Table de caractères ASCII   */ -    PangoAttrList *attribs;                 /* Liste d'attributs (vide)    */ -    GList *list;                            /* Liste d'éléments distincts  */ - -    if (!class->ascii_init_done) -    { -        class->ascii_init_done = true; - -        /* Construction d'une chaîne adéquate */ - -        for (i = 0; i < 128; ++i) -            switch (i) -            { -                case 0 ... 31: -                    ascii_chars[i] = '?'; -                    break; -                case 32 ... 127: -                    ascii_chars[i] = i; -                    break; -                default: -                    ascii_chars[i] = '?'; -                    break; -            } - -        /* Analyse de la chaîne créée */ - -        attribs = pango_attr_list_new(); -        list = pango_itemize(context, ascii_chars, 0, 128, attribs, NULL); - -        class->ascii_ready = (list != NULL && list->next == NULL); - -        if (class->ascii_ready) -        { -            PangoItem   *item; -            //int         width; - -            item  = (PangoItem *)list->data; -            //width = gui.char_width * PANGO_SCALE; - -            /* Remember the shape engine used for ASCII. */ -            //default_shape_engine = item->analysis.shape_engine; - -            class->ascii_font = item->analysis.font; -            g_object_ref(class->ascii_font); - -            class->ascii_glyphs = pango_glyph_string_new(); - -            pango_shape(ascii_chars, 128, &item->analysis, class->ascii_glyphs); - -            class->ascii_ready = (class->ascii_glyphs->num_glyphs == 128); - - - -#if 0 -            for (i = 0; i < class->ascii_glyphs->num_glyphs; i++) -            { -                PangoGlyphGeometry *geom; - -                geom = &class->ascii_glyphs->glyphs[i].geometry; -                //geom->x_offset += MAX(0, width - geom->width) / 2; -                //geom->width = /*width*/8 * PANGO_SCALE; -            } -#endif - -        } - -        //g_list_foreach(list, (GFunc)&pango_item_free, NULL); -        //g_list_free(list); - -        //pango_attr_list_unref(attribs); - -    } - -    return class->ascii_ready; - -} - - - - - +/* Détermine le type du fragment de caractères aux propriétés communes. */ +G_DEFINE_TYPE(GBufferSegment, g_buffer_segment, G_TYPE_OBJECT);  /******************************************************************************  *                                                                             * -*  Paramètres  : context = contexte Pango pour l'analyse des caractères.      * -*                attribs = propriétés de la zone de texte.                    * -*                text    = chaîne de caractères à traiter.                    * -*                length  = quantité de ces caractères.                        * +*  Paramètres  : class = classe de composant GTK à initialiser.               *  *                                                                             * -*  Description : Crée un nouveau fragment de texte avec des propriétés.       * +*  Description : Procède à l'initialisation d'une classe de fragment de texte.*  *                                                                             * -*  Retour      : Composant GTK créé.                                          * +*  Retour      : -                                                            *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             *  ******************************************************************************/ -static void g_buffer_segment_prepare(GBufferSegment *segment, PangoContext *context, PangoAttrList *attribs, const char *text, size_t length) +static void g_buffer_segment_class_init(GBufferSegmentClass *class)  { -    PangoGlyphString *glyphs;               /* Caractères traités          */ -    bool must_use_pango;                    /* Passage par Pango obligé ?  */ -    PangoAttrIterator *iterator;            /* Guide de parcours           */ -    PangoAttribute *attrib;                 /* Attribut générique          */ - -    GList           *item_list; -    PangoItem   *item; - -    //PangoRectangle logical; - - -    const char *max; -    const char *iter; - -    GBufferSegmentClass *class; - -    size_t i; - -    PangoGlyphInfo *info; -    gint *log_clusters; -    PangoGlyphInfo *ref; - -    PangoFont *font;                        /* Modèle de police            */ -    PangoFontDescription *desc;             /* Description de cette police */ - - - - -    glyphs = pango_glyph_string_new(); - - - - - - -    /* Existe-t-il des attributs particuliers ? */ - -    must_use_pango = false; - -    iterator = pango_attr_list_get_iterator(attribs); - -    attrib = pango_attr_iterator_get(iterator, PANGO_ATTR_WEIGHT); -    must_use_pango |= (attrib != NULL); - -    attrib = pango_attr_iterator_get(iterator, PANGO_ATTR_STYLE); -    must_use_pango |= (attrib != NULL); - -    pango_attr_iterator_destroy(iterator); - -    if (must_use_pango) -        goto not_ascii; - - - - - - - - -    /** -     * Petite astuce empruntée à Vim... -     * (cf. src/gui_gtk_x11.c, fonction gui_gtk2_draw_string()). -     * On essaie de traiter à la main les morceaux de -     * texte. Pour ceux en ASCII pur, le gain est non négligeable. -     */ - -    max = text + length; - -    goto not_ascii; - -    for (iter = text; iter < max; iter++) -        if (*iter & 0x80) -            goto not_ascii; - -    class = G_BUFFER_SEGMENT_GET_CLASS(segment); - -    if (!ascii_glyph_table_init(class, context)) -        goto not_ascii; - -    pango_glyph_string_set_size(glyphs, length); - -    info = glyphs->glyphs; -    log_clusters = glyphs->log_clusters; -    ref = class->ascii_glyphs->glyphs; - -    for (i = 0; i < length; i++) -    { -        info[i] = ref[(unsigned int)text[i]]; -        log_clusters[i] = i; -    } -  -    font = class->ascii_font; - -    goto next; - - not_ascii: - -    item_list = pango_itemize(context, text, 0, length, attribs, NULL); +    gchar *filename;                        /* Accès à une image 1x1       */ +    cairo_font_slant_t s;                   /* Boucle de parcours #1       */ +    cairo_font_weight_t w;                  /* Boucle de parcours #2       */ +    cairo_t **cr;                           /* Contexte à créer            */ +    cairo_surface_t *surface;               /* Surface pour dessin Cairo   */ -    /* -    if (!(item_list != NULL && item_list->next == NULL)) -        printf("ouich\n"); -    */ +    /* Contextes pour les mesures initiales */ -    item  = (PangoItem *)item_list->data; -    pango_shape(text, length, &item->analysis, glyphs); +    filename = find_pixmap_file("nil.png"); +    if (filename == NULL) abort(); -    font = item->analysis.font; - - next: - -    desc = pango_font_describe(font); -    segment->desc = pango_font_description_copy(desc); - -    pango_glyph_string_extents(glyphs, font, NULL, &segment->logical); - -    //pango_shape(text, length, &item->analysis, glyphs); +    for (s = CAIRO_FONT_SLANT_NORMAL; s < CAIRO_FONT_SLANT_COUNT; s++) +        for (w = CAIRO_FONT_WEIGHT_NORMAL; w < CAIRO_FONT_WEIGHT_COUNT; w++) +        { +            cr = &class->font_ctxts[CAIRO_FONT_INDEX(s, w)]; +            surface = cairo_image_surface_create_from_png(filename); +            *cr = cairo_create(surface); +            cairo_surface_destroy(surface); -    //pango_glyph_string_extents(glyphs, class->ascii_font, NULL, &segment->logical); +            cairo_select_font_face(*cr, "mono", s, w); +            cairo_set_font_size(*cr, 13); -    segment->logical.y /= PANGO_SCALE; -    segment->logical.width /= PANGO_SCALE; -    segment->logical.height /= PANGO_SCALE; +        } -    segment->glyphs = glyphs; +    g_free(filename); + +    /* Propriétés d'impression */ + +#define GET_RESET_PATTERN(tp)                           \ +    ({                                                  \ +        rendering_pattern_t *__p;                       \ +        __p = &class->patterns[RTT_ ## tp];             \ +        memset(__p, 0, sizeof(rendering_pattern_t));    \ +        __p;                                            \ +    }) + +#define DEFINE_SIMPLE_PATTERN(rtt)                      \ +    do                                                  \ +    {                                                   \ +        rendering_pattern_t *__ptn;                     \ +        __ptn = GET_RESET_PATTERN(rtt);                 \ +        __ptn->slant = CAIRO_FONT_SLANT_NORMAL;         \ +        __ptn->weight = CAIRO_FONT_WEIGHT_NORMAL;       \ +        __ptn->foreground.pixel = COLOR_NOT_SET;        \ +    }                                                   \ +    while (0) + +#define DEFINE_PATTERN(rtt, s, w, r, g, b)              \ +    do                                                  \ +    {                                                   \ +        rendering_pattern_t *__ptn;                     \ +        __ptn = GET_RESET_PATTERN(rtt);                 \ +        __ptn->slant = CAIRO_FONT_SLANT_ ## s;          \ +        __ptn->weight = CAIRO_FONT_WEIGHT_ ## w;        \ +        __ptn->foreground.red = r;                      \ +        __ptn->foreground.green = g;                    \ +        __ptn->foreground.blue = b;                     \ +        __ptn->foreground.pixel = COLOR_SET;            \ +    }                                                   \ +    while (0) + +    DEFINE_PATTERN(RAW,         NORMAL, NORMAL, 0, 0, 0); +    DEFINE_PATTERN(COMMENT,     NORMAL, NORMAL, 14335, 45311, 23551); +    DEFINE_PATTERN(INDICATION,  ITALIC, NORMAL, 33410, 33410, 33410); +    DEFINE_PATTERN(RAW_CODE,    NORMAL, NORMAL, 48895, 48895, 48895); +    DEFINE_PATTERN(INSTRUCTION, NORMAL, NORMAL, 0, 0, 0); +    DEFINE_PATTERN(IMMEDIATE,   NORMAL, NORMAL, 41215, 8447, 61695); +    DEFINE_PATTERN(REGISTER,    NORMAL, NORMAL, 16895, 16895, 53759); +    DEFINE_PATTERN(PUNCT,       NORMAL, BOLD,   0, 0, 0); +    DEFINE_PATTERN(HOOK,        NORMAL, BOLD,   0, 0, 0); +    DEFINE_PATTERN(SIGNS,       NORMAL, BOLD,   0, 0, 0); +    DEFINE_SIMPLE_PATTERN(LTGT); +    DEFINE_PATTERN(SECTION,     NORMAL, NORMAL, 51200, 2560, 2560); +    DEFINE_SIMPLE_PATTERN(SEGMENT); +    DEFINE_PATTERN(STRING,      NORMAL, NORMAL, 52224, 32256, 0); +    DEFINE_PATTERN(VAR_NAME,    NORMAL, NORMAL, 0, 0, 0); +    DEFINE_PATTERN(KEY_WORD,    NORMAL, NORMAL, 0, 0, 0); +    DEFINE_PATTERN(ERROR,       NORMAL, BOLD,   65535, 0, 0);  } - - - - - - - - - - - - -/* Détermine le type du fragment de caractères aux propriétés communes. */ -G_DEFINE_TYPE(GBufferSegment, g_buffer_segment, G_TYPE_OBJECT); - - -  /******************************************************************************  *                                                                             * -*  Paramètres  : class = classe de composant GTK à initialiser.               * +*  Paramètres  : segment = composant GTK à initialiser.                       *  *                                                                             * -*  Description : Procède à l'initialisation d'une classe de fragment de texte.* +*  Description : Procède à l'initialisation d'un fragment de texte.           *  *                                                                             *  *  Retour      : -                                                            *  *                                                                             * @@ -352,7 +212,7 @@ G_DEFINE_TYPE(GBufferSegment, g_buffer_segment, G_TYPE_OBJECT);  *                                                                             *  ******************************************************************************/ -static void g_buffer_segment_class_init(GBufferSegmentClass *class) +static void g_buffer_segment_init(GBufferSegment *segment)  {  } @@ -360,54 +220,77 @@ static void g_buffer_segment_class_init(GBufferSegmentClass *class)  /******************************************************************************  *                                                                             * -*  Paramètres  : segment = composant GTK à initialiser.                       * +*  Paramètres  : type   = propriétés de la zone de texte.                     * +*                text   = chaîne de caractères à traiter.                     * +*                length = quantité de ces caractères.                         *  *                                                                             * -*  Description : Procède à l'initialisation d'un fragment de texte.           * +*  Description : Crée un nouveau fragment de texte avec des propriétés.       *  *                                                                             * -*  Retour      : -                                                            * +*  Retour      : Composant GTK créé.                                          *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             *  ******************************************************************************/ -static void g_buffer_segment_init(GBufferSegment *segment) +GBufferSegment *g_buffer_segment_new(RenderingTagType type, const char *text, size_t length)  { +    GBufferSegment *result;                 /* Composant à retourner       */ +    GBufferSegmentClass *class;             /* Stockage de styles préparés */  + +    result = g_object_new(G_TYPE_BUFFER_SEGMENT, NULL); + +    result->text = strdup(text); +    result->hash = fnv_64a_hash(text); + +    class = G_BUFFER_SEGMENT_GET_CLASS(result); +    result->pattern = &class->patterns[type]; + +    g_buffer_segment_prepare(result, text); + +    g_buffer_segment_set_style(result, SRS_CLASSIC); + +    return result;  }  /******************************************************************************  *                                                                             * -*  Paramètres  : attribs = propriétés de la zone de texte.                    * +*  Paramètres  : segment = instance de segment à affiner.                     *  *                text    = chaîne de caractères à traiter.                    * -*                length  = quantité de ces caractères.                        *  *                                                                             * -*  Description : Crée un nouveau fragment de texte avec des propriétés.       * +*  Description : Définit les dernières propriétés de rendu restantes.         *  *                                                                             * -*  Retour      : Composant GTK créé.                                          * +*  Retour      : -                                                            *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             *  ******************************************************************************/ -GBufferSegment *g_buffer_segment_new(PangoAttrList *attribs, const char *text, size_t length) +static void g_buffer_segment_prepare(GBufferSegment *segment, const char *text)  { -    GBufferSegment *result;                 /* Composant à retourner       */ +    GBufferSegmentClass *class;             /* Classe associée à l'instance*/ +    cairo_font_slant_t slant;               /* Style d'impression          */ +    cairo_font_weight_t weight;             /* Poids de la police          */ +    cairo_t *cr;                            /* Contexte de rendu           */ -    result = g_object_new(G_TYPE_BUFFER_SEGMENT, NULL); +    /* Taille */ -    result->text = strdup(text); -    result->hash = fnv_64a_hash(text); +    class = G_BUFFER_SEGMENT_GET_CLASS(segment); -    result->attribs = pango_attr_list_ref(attribs); +    slant = segment->pattern->slant; +    weight = segment->pattern->weight; -    g_buffer_segment_prepare(result, get_global_pango_context(), attribs, text, length); +    cr = class->font_ctxts[CAIRO_FONT_INDEX(slant, weight)]; -    g_buffer_segment_cache_colors(result); +    cairo_text_extents(cr, text, &segment->extents); -    g_buffer_segment_set_style(result, SRS_CLASSIC); +    /* Couleurs */ -    return result; +    segment->alt_fg.red = 65535 - segment->pattern->foreground.red; +    segment->alt_fg.green = 65535 - segment->pattern->foreground.green; +    segment->alt_fg.blue = 65535 - segment->pattern->foreground.blue; +    segment->alt_fg.pixel = segment->pattern->foreground.pixel;  } @@ -471,7 +354,7 @@ const char *g_buffer_segment_get_text(const GBufferSegment *segment)  gint g_buffer_segment_get_width(const GBufferSegment *segment)  { -    return segment->logical.width; +    return segment->extents.x_advance;  } @@ -497,8 +380,6 @@ gint g_buffer_segment_get_caret_position(const GBufferSegment *segment, gint x)      width = g_buffer_segment_get_width(segment); -    printf("(seg) x=%d  width=%d\n", x, width); -      if (x <= 0)          result = 0; @@ -507,14 +388,7 @@ gint g_buffer_segment_get_caret_position(const GBufferSegment *segment, gint x)      else      { -        if (strlen(segment->text) != segment->glyphs->num_glyphs) -        { - -            printf("STOP ::: %d vs %d\n", strlen(segment->text), segment->glyphs->num_glyphs); -            exit(0); -        } - -        char_width = width / segment->glyphs->num_glyphs; +        char_width = width / strlen(segment->text);          result = (x / char_width) * char_width;          if ((x % char_width) > (char_width / 2)) @@ -530,46 +404,6 @@ gint g_buffer_segment_get_caret_position(const GBufferSegment *segment, gint x)  /******************************************************************************  *                                                                             *  *  Paramètres  : segment = fragment de texte à manipuler.                     * -*                                                                             * -*  Description : (Re)charge les couleurs à partir de la liste d'attributs.    * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -void g_buffer_segment_cache_colors(GBufferSegment *segment) -{ -    PangoAttrIterator *iterator;            /* Guide de parcours           */ -    PangoAttribute *attrib;                 /* Attribut générique          */ -    PangoAttrColor *color_attrib;           /* Propriété de couleur        */ - -    iterator = pango_attr_list_get_iterator(segment->attribs); - -    /* Couleur d'impression */ - -    attrib = pango_attr_iterator_get(iterator, PANGO_ATTR_FOREGROUND); -    segment->cache_fg.pixel = (attrib != NULL ? COLOR_SET : COLOR_NOT_SET); - -    if (segment->cache_fg.pixel == COLOR_SET) -    { -        color_attrib = (PangoAttrColor *)attrib; - -        segment->cache_fg.red = color_attrib->color.red; -        segment->cache_fg.green = color_attrib->color.green; -        segment->cache_fg.blue = color_attrib->color.blue; - -    } - -    pango_attr_iterator_destroy(iterator); - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : segment = fragment de texte à manipuler.                     *  *                style   = style de rendu pour le segment.                    *  *                                                                             *  *  Description : Module l'apparence finale du composant.                      * @@ -588,7 +422,7 @@ void g_buffer_segment_set_style(GBufferSegment *segment, SegRenderingStyle style      {          default:          case SRS_CLASSIC: -            segment->cache_used_fg = &segment->cache_fg; +            segment->used_fg = &segment->pattern->foreground;              break;          case SRS_HIGHLIGHT_SAME: @@ -597,11 +431,7 @@ void g_buffer_segment_set_style(GBufferSegment *segment, SegRenderingStyle style              segment->cache_bg.green = 32768;              segment->cache_bg.blue = 32768; -            segment->cache_alt_fg.red = 65535 - segment->cache_fg.red; -            segment->cache_alt_fg.green = 65535 - segment->cache_fg.green; -            segment->cache_alt_fg.blue = 65535 - segment->cache_fg.blue; - -            segment->cache_used_fg = &segment->cache_alt_fg; +            segment->used_fg = &segment->alt_fg;              break; @@ -614,7 +444,6 @@ void g_buffer_segment_set_style(GBufferSegment *segment, SegRenderingStyle style  *                                                                             *  *  Paramètres  : segment = fragment de texte à manipuler.                     *  *                cairo   = contexte graphique à utiliser pour les pinceaux.   * -*                fcache  = gestionnaire des polices pour l'impression.        *  *                x       = abscisse du point d'impression (à maj). [OUT]      *  *                y       = ordonnée du point d'impression.                    *  *                                                                             * @@ -626,23 +455,23 @@ void g_buffer_segment_set_style(GBufferSegment *segment, SegRenderingStyle style  *                                                                             *  ******************************************************************************/ -void g_buffer_segment_draw(GBufferSegment *segment, cairo_t *cairo, GFontCache *fcache, gint *x, gint y) +void g_buffer_segment_draw(GBufferSegment *segment, cairo_t *cairo, gint *x, gint y)  { -    PangoFont *font;                        /* Police d'impression         */ -    /* FIXME */ -    g_buffer_segment_prepare(segment, get_global_pango_context(), -                             segment->attribs, segment->text, strlen(segment->text)); +    cairo_font_extents_t extents; + +      /* Fond du texte */ -    if (segment->style != SRS_CLASSIC) +    if (segment->style != SRS_CLASSIC || 1)      {          cairo_set_source_rgb(cairo,                               segment->cache_bg.red / 65535.0,                               segment->cache_bg.green / 65535.0,                               segment->cache_bg.blue / 65535.0); -        cairo_rectangle(cairo, *x, y, segment->logical.width, segment->logical.height); +        cairo_rectangle(cairo, *x, y, segment->extents.x_advance, 17); +          cairo_set_operator(cairo, CAIRO_OPERATOR_DIFFERENCE);          cairo_fill(cairo);          cairo_set_operator(cairo, CAIRO_OPERATOR_OVER); @@ -651,19 +480,34 @@ void g_buffer_segment_draw(GBufferSegment *segment, cairo_t *cairo, GFontCache *      /* Couleur d'impression */ -    if (segment->cache_fg.pixel == COLOR_SET) +    if (segment->used_fg->pixel == COLOR_SET)          cairo_set_source_rgb(cairo, -                             segment->cache_used_fg->red / 65535.0, -                             segment->cache_used_fg->green / 65535.0, -                             segment->cache_used_fg->blue / 65535.0); +                             segment->used_fg->red / 65535.0, +                             segment->used_fg->green / 65535.0, +                             segment->used_fg->blue / 65535.0);      /* Impression du texte */ -    cairo_move_to(cairo, *x, y - segment->logical.y); +    cairo_select_font_face(cairo, "mono", segment->pattern->slant, segment->pattern->weight); +    cairo_set_font_size(cairo, 13); + + + + +    cairo_move_to(cairo, *x, y + 17 - 3); + + + + +    cairo_font_extents(cairo, &extents); + +    if (extents.descent != 3) +    printf("FONT : %g, %g\n", extents.ascent, extents.descent); + +    cairo_show_text(cairo, segment->text); -    font = g_font_cache_lookup(fcache, segment->desc); -    pango_cairo_show_glyph_string(cairo, font, segment->glyphs); +    //printf(">> %s >> %f %f\n", segment->text, segment->extents.width, segment->extents.x_advance); -    *x += segment->logical.width; +    *x += segment->extents.x_advance;  } diff --git a/src/glibext/gbuffersegment.h b/src/glibext/gbuffersegment.h index bc0d512..76465a7 100644 --- a/src/glibext/gbuffersegment.h +++ b/src/glibext/gbuffersegment.h @@ -31,9 +31,6 @@  #include <pango/pango.h> -#include "gfontcache.h" - -  #define G_TYPE_BUFFER_SEGMENT                  (g_buffer_segment_get_type())  #define G_BUFFER_SEGMENT(obj)                  (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_BUFFER_SEGMENT, GBufferSegment)) @@ -43,6 +40,40 @@  #define G_BUFFER_SEGMENT_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BUFFER_SEGMENT, GBufferSegmentClass)) +/* Types de partie de rendu */ +typedef enum _RenderingTagType +{ +    RTT_RAW,                                /* Contenu brut                */ + +    RTT_COMMENT,                            /* Commentaire                 */ +    RTT_INDICATION,                         /* Aide à la lecture           */ +    RTT_RAW_CODE,                           /* Code binaire brut           */ + +    RTT_INSTRUCTION,                        /* Code binaire brut           */ + +    RTT_IMMEDIATE,                          /* Valeur immédiate            */ + +    RTT_REGISTER,                           /* Registre                    */ + +    RTT_PUNCT,                              /* Signes de ponctuation       */ +    RTT_HOOK,                               /* Crochets '[' et ']'         */ +    RTT_SIGNS,                              /* Signes '+', '-' et '*'      */ +    RTT_LTGT,                               /* Caractères '<' et '>'       */ + +    RTT_SECTION,                            /* Identifiant de section      */ +    RTT_SEGMENT,                            /* Indication de segment       */ +    RTT_STRING,                             /* Chaîne de caractères avec " */ + +    RTT_VAR_NAME,                           /* Nom de variable             */ + +    RTT_KEY_WORD,                           /* Mot clef de langage         */ + +    RTT_ERROR,                              /* Erreur "interne"            */ + +    RTT_COUNT + +} RenderingTagType; +  /* Types de rendus */  typedef enum _SegRenderingStyle  { @@ -75,7 +106,7 @@ typedef struct _GBufferSegmentClass GBufferSegmentClass;  GType g_buffer_segment_get_type(void);  /* Crée un nouveau fragment de texte avec des propriétés. */ -GBufferSegment *g_buffer_segment_new(PangoAttrList *, const char *, size_t); +GBufferSegment *g_buffer_segment_new(RenderingTagType, const char *, size_t);  /* Indique si les textes de deux segments sont identiques. */  bool g_buffer_segment_compare(const GBufferSegment *, const GBufferSegment *); @@ -89,14 +120,11 @@ gint g_buffer_segment_get_width(const GBufferSegment *);  /* Fournit la position idéale pour un marqueur. */  gint g_buffer_segment_get_caret_position(const GBufferSegment *, gint); -/* (Re)charge les couleurs à partir de la liste d'attributs. */ -void g_buffer_segment_cache_colors(GBufferSegment *); -  /* Module l'apparence finale du composant. */  void g_buffer_segment_set_style(GBufferSegment *, SegRenderingStyle);  /* Imprime le fragment de texte représenté. */ -void g_buffer_segment_draw(GBufferSegment *, cairo_t *, GFontCache *, gint *, gint); +void g_buffer_segment_draw(GBufferSegment *, cairo_t *, gint *, gint); diff --git a/src/glibext/gcodebuffer.c b/src/glibext/gcodebuffer.c index 8a70ad5..4a4e38f 100644 --- a/src/glibext/gcodebuffer.c +++ b/src/glibext/gcodebuffer.c @@ -142,8 +142,6 @@ struct _GBufferView      vmpa_t start;                           /* Première ligne intégrée     */      vmpa_t end;                             /* Dernière ligne intégrée     */ -    GFontCache *fcache;                     /* Cache pour les polices      */ -      gint line_height;                       /* Hauteur maximale des lignes */      gint max_widths[BLC_COUNT];             /* Taille cachée des colonnes  */      gint left_margin;                       /* Marge gauche + espace       */ @@ -726,8 +724,6 @@ static void g_buffer_view_class_init(GBufferViewClass *class)  static void g_buffer_view_init(GBufferView *buffer)  { -    buffer->fcache = g_font_cache_new(); -      g_buffer_view_reset_required_height(buffer);      g_buffer_view_reset_required_widths(buffer); @@ -1403,7 +1399,7 @@ void g_buffer_view_draw(const GBufferView *view, cairo_t *cr, gint fake_x, gint                  view->drawing_extra(lines[i], drawable, gc, fake_x, y, view->drawing_data);              */ -            g_buffer_line_draw(lines[i], cr, view->fcache, +            g_buffer_line_draw(lines[i], cr,                                 view->max_widths, real_x, y, addr, code);              y += view->line_height; diff --git a/src/glibext/gfontcache.c b/src/glibext/gfontcache.c deleted file mode 100644 index 2441d27..0000000 --- a/src/glibext/gfontcache.c +++ /dev/null @@ -1,294 +0,0 @@ - -/* OpenIDA - Outil d'analyse de fichiers binaires - * gfontcache.c - mise en cache avec actualisation des polices - * - * Copyright (C) 2012 Cyrille Bagard - * - *  This file is part of OpenIDA. - * - *  OpenIDA 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. - * - *  OpenIDA 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 Foobar.  If not, see <http://www.gnu.org/licenses/>. - */ - - -#include "gfontcache.h" - - - -/* ----------------------- MISE EN PLACE D'UN CONTEXTE GLOBAL ----------------------- */ - - -/* Utilisable par toutes les impressions. */ -static PangoContext *_context = NULL; - - - -/* ---------------------------- CACHE DE POLICES PAR VUE ---------------------------- */ - - -/* Description d'un cache pour polices (instance) */ -struct _GFontCache -{ -    GObject parent;                         /* A laisser en premier        */ - -    GHashTable *table;                      /* Associations desc./police   */ - -    GtkWidget *widget; - -}; - -/* Description d'un cache pour polices (classe) */ -struct _GFontCacheClass -{ -    GObjectClass parent;                    /* A laisser en premier        */ - -}; - - -/* Initialise la classe des caches pour polices. */ -static void g_font_cache_class_init(GFontCacheClass *); - -/* Initialise un cache pour polices. */ -static void g_font_cache_init(GFontCache *); - -/* Supprime toutes les références externes. */ -static void g_font_cache_dispose(GFontCache *); - -/* Procède à la libération totale de la mémoire. */ -static void g_font_cache_finalize(GFontCache *); - - - -/* ---------------------------------------------------------------------------------- */ -/*                         MISE EN PLACE D'UN CONTEXTE GLOBAL                         */ -/* ---------------------------------------------------------------------------------- */ - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : -                                                            * -*                                                                             * -*  Description : Initialise le contexte Pango pour la gestion des textes.     * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -void init_global_pango_context(void) -{ -    PangoFontDescription *desc;             /* Police de caractères        */ - -    _context = gdk_pango_context_get(); - -    desc = pango_font_description_from_string("mono 10"); -    pango_context_set_font_description(_context, desc); -    pango_font_description_free(desc); - -    pango_context_set_base_dir(_context, PANGO_DIRECTION_LTR); -    pango_context_set_language(_context, gtk_get_default_language()); - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : -                                                            * -*                                                                             * -*  Description : Fournit le contexte Pango global  pour l'impression.         * -*                                                                             * -*  Retour      : Contexte prêt à emploi.                                      * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -PangoContext *get_global_pango_context(void) -{ -    return _context; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : -                                                            * -*                                                                             * -*  Description : Supprime le contexte Pango pour la gestion des textes.       * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -void exit_global_pango_context(void) -{ -    g_object_unref(G_OBJECT(_context)); - -} - - - -/* ---------------------------------------------------------------------------------- */ -/*                              CACHE DE POLICES PAR VUE                              */ -/* ---------------------------------------------------------------------------------- */ - - - -/* Indique le type défini pour un cache pour polices. */ -G_DEFINE_TYPE(GFontCache, g_font_cache, G_TYPE_OBJECT); - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : class = classe à initialiser.                                * -*                                                                             * -*  Description : Initialise la classe des caches pour polices.                * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_font_cache_class_init(GFontCacheClass *class) -{ -    GObjectClass *object;                   /* Autre version de la classe  */ - -    object = G_OBJECT_CLASS(class); - -    object->dispose = (GObjectFinalizeFunc/* ! */)g_font_cache_dispose; -    object->finalize = (GObjectFinalizeFunc)g_font_cache_finalize; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : fcache = instance à initialiser.                             * -*                                                                             * -*  Description : Initialise un cache pour polices.                            * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_font_cache_init(GFontCache *fcache) -{ -    fcache->table = g_hash_table_new_full((GHashFunc)pango_font_description_hash, -                                          (GEqualFunc)pango_font_description_equal, -                                          (GDestroyNotify)pango_font_description_free, -                                          (GDestroyNotify)g_object_unref); - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : fcache = instance d'objet GLib à traiter.                    * -*                                                                             * -*  Description : Supprime toutes les références externes.                     * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_font_cache_dispose(GFontCache *fcache) -{ -    g_hash_table_destroy(fcache->table); - -    G_OBJECT_CLASS(g_font_cache_parent_class)->dispose(G_OBJECT(fcache)); - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : fcache = instance d'objet GLib à traiter.                    * -*                                                                             * -*  Description : Procède à la libération totale de la mémoire.                * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void g_font_cache_finalize(GFontCache *fcache) -{ -    G_OBJECT_CLASS(g_font_cache_parent_class)->finalize(G_OBJECT(fcache)); - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : -                                                            * -*                                                                             * -*  Description : Crée un bloc virtuel d'instructions.                         * -*                                                                             * -*  Retour      : Adresse de la structure mise en place.                       * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -GFontCache *g_font_cache_new(void) -{ -    GFontCache *result;                     /* Structure à retourner       */ - -    result = g_object_new(G_TYPE_FONT_CACHE, NULL); - -    return result; - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : fcache = instance à consulter, voire compléter.              * -*                desc   = description de la police recherchée.                * -*                                                                             * -*  Description : Fournit une police utilisable répondant au besoin.           * -*                                                                             * -*  Retour      : Police prête à usage.                                        * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -PangoFont *g_font_cache_lookup(GFontCache *fcache, const PangoFontDescription *desc) -{ -    PangoFont *result;                      /* Instance à retourner        */ -    PangoFontDescription *key;              /* Copie de la description     */ - -    result = (PangoFont *)g_hash_table_lookup(fcache->table, desc); - -    if (result == NULL) -    { -        result = pango_context_load_font(get_global_pango_context(), desc); - -        key = pango_font_description_copy(desc); -        g_hash_table_insert(fcache->table, key, result); - -    } - -    return result; - -} diff --git a/src/glibext/gfontcache.h b/src/glibext/gfontcache.h deleted file mode 100644 index 2132a34..0000000 --- a/src/glibext/gfontcache.h +++ /dev/null @@ -1,79 +0,0 @@ - -/* OpenIDA - Outil d'analyse de fichiers binaires - * gfontcache.h - prototypes pour la mise en cache avec actualisation des polices - * - * Copyright (C) 2012 Cyrille Bagard - * - *  This file is part of OpenIDA. - * - *  OpenIDA 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. - * - *  OpenIDA 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 Foobar.  If not, see <http://www.gnu.org/licenses/>. - */ - - -#ifndef _GLIBEXT_GFONTCACHE_H -#define _GLIBEXT_GFONTCACHE_H - - -#include <glib.h> -#include <glib-object.h> -#include <gtk/gtk.h> -#include <pango/pango-context.h> -#include <pango/pango-font.h> - - - -/* ----------------------- MISE EN PLACE D'UN CONTEXTE GLOBAL ----------------------- */ - - -/* Initialise le contexte Pango pour la gestion des textes. */ -void init_global_pango_context(void); - -/* Fournit le contexte Pango global  pour l'impression. */ -PangoContext *get_global_pango_context(void); - -/* Supprime le contexte Pango pour la gestion des textes. */ -void exit_global_pango_context(void); - - - -/* ---------------------------- CACHE DE POLICES PAR VUE ---------------------------- */ - - -#define G_TYPE_FONT_CACHE               g_font_cache_get_type() -#define G_FONT_CACHE(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_font_cache_get_type(), GFontCache)) -#define G_IS_FONT_CACHE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_font_cache_get_type())) -#define G_FONT_CACHE_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FONT_CACHE, GFontCacheClass)) -#define G_IS_FONT_CACHE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FONT_CACHE)) -#define G_FONT_CACHE_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_FONT_CACHE, GFontCacheClass)) - - -/* Description d'un cache pour polices (instance) */ -typedef struct _GFontCache GFontCache; - -/* Description d'un cache pour polices (classe) */ -typedef struct _GFontCacheClass GFontCacheClass; - - -/* Indique le type défini pour un cache pour polices. */ -GType g_font_cache_get_type(void); - -/* Crée un bloc virtuel d'instructions. */ -GFontCache *g_font_cache_new(void); - -/* Fournit une police utilisable répondant au besoin. */ -PangoFont *g_font_cache_lookup(GFontCache *, const PangoFontDescription *); - - - -#endif  /* _GLIBEXT_GFONTCACHE_H */  | 
