misc/libfreetype/src/cache/ftcglyph.h
author unc0rr
Fri, 25 Jan 2013 22:33:26 +0400
changeset 8436 b89aacebb9db
parent 5172 88f2e05288ba
permissions -rw-r--r--
- Also pass unknown cmds to the server when in room - Fix some warnings
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
/*  ftcglyph.h                                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
/*    FreeType abstract glyph cache (specification).                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 2000-2001, 2003, 2004, 2006, 2007, 2011 by                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*  This file is part of the FreeType project, and may only be used,       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  modified, and distributed under the terms of the FreeType project      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
/*  this file you indicate that you have read the license and              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
/*  understand and accept it fully.                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
   *  FTC_GCache is an _abstract_ cache object optimized to store glyph
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
   *  data.  It works as follows:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
   *   - It manages FTC_GNode objects. Each one of them can hold one or more
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
   *     glyph `items'.  Item types are not specified in the FTC_GCache but
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
   *     in classes that extend it.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
   *   - Glyph attributes, like face ID, character size, render mode, etc.,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
   *     can be grouped into abstract `glyph families'.  This avoids storing
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
   *     the attributes within the FTC_GCache, since it is likely that many
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
   *     FTC_GNodes will belong to the same family in typical uses.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
   *   - Each FTC_GNode is thus an FTC_Node with two additional fields:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
   *       * gindex: A glyph index, or the first index in a glyph range.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
   *       * family: A pointer to a glyph `family'.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
   *   - Family types are not fully specific in the FTC_Family type, but
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
   *     by classes that extend it.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
   *  Note that both FTC_ImageCache and FTC_SBitCache extend FTC_GCache.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
   *  They share an FTC_Family sub-class called FTC_BasicFamily which is
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
   *  used to store the following data: face ID, pixel/point sizes, load
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
   *  flags.  For more details see the file `src/cache/ftcbasic.c'.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
   *  Client applications can extend FTC_GNode with their own FTC_GNode
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
   *  and FTC_Family sub-classes to implement more complex caches (e.g.,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
   *  handling automatic synthesis, like obliquing & emboldening, colored
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
   *  glyphs, etc.).
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
   *  See also the FTC_ICache & FTC_SCache classes in `ftcimage.h' and
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
   *  `ftcsbits.h', which both extend FTC_GCache with additional
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
   *  optimizations.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
   *  A typical FTC_GCache implementation must provide at least the
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
   *  following:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
   *  - FTC_GNode sub-class, e.g. MyNode, with relevant methods:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
   *        my_node_new            (must call FTC_GNode_Init)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
   *        my_node_free           (must call FTC_GNode_Done)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
   *        my_node_compare        (must call FTC_GNode_Compare)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
   *        my_node_remove_faceid  (must call ftc_gnode_unselect in case
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
   *                                of match)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
   *  - FTC_Family sub-class, e.g. MyFamily, with relevant methods:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
   *        my_family_compare
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
   *        my_family_init
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
   *        my_family_reset (optional)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
   *        my_family_done
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
   *  - FTC_GQuery sub-class, e.g. MyQuery, to hold cache-specific query
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
   *    data.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
   *  - Constant structures for a FTC_GNodeClass.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
   *  - MyCacheNew() can be implemented easily as a call to the convenience
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
   *    function FTC_GCache_New.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
   *  - MyCacheLookup with a call to FTC_GCache_Lookup.  This function will
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
   *    automatically:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
   *    - Search for the corresponding family in the cache, or create
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
   *      a new one if necessary.  Put it in FTC_GQUERY(myquery).family
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
   *    - Call FTC_Cache_Lookup.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
   *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
   *    If it returns NULL, you should create a new node, then call
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
   *    ftc_cache_add as usual.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
  /* Important: The functions defined in this file are only used to        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
  /*            implement an abstract glyph cache class.  You need to      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
  /*            provide additional logic to implement a complete cache.    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
  /*********                                                       *********/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
  /*********             WARNING, THIS IS BETA CODE.               *********/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
  /*********                                                       *********/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
#ifndef __FTCGLYPH_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
#define __FTCGLYPH_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
#include "ftcmanag.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
FT_BEGIN_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
 /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
  *  We can group glyphs into `families'.  Each family correspond to a
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
  *  given face ID, character size, transform, etc.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
  *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
  *  Families are implemented as MRU list nodes.  They are
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
  *  reference-counted.
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
  typedef struct  FTC_FamilyRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
    FTC_MruNodeRec    mrunode;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
    FT_UInt           num_nodes; /* current number of nodes in this family */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
    FTC_Cache         cache;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
    FTC_MruListClass  clazz;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
  } FTC_FamilyRec, *FTC_Family;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
#define  FTC_FAMILY(x)    ( (FTC_Family)(x) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
#define  FTC_FAMILY_P(x)  ( (FTC_Family*)(x) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
  typedef struct  FTC_GNodeRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
    FTC_NodeRec      node;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
    FTC_Family       family;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
    FT_UInt          gindex;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
  } FTC_GNodeRec, *FTC_GNode;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
#define FTC_GNODE( x )    ( (FTC_GNode)(x) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
#define FTC_GNODE_P( x )  ( (FTC_GNode*)(x) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
  typedef struct  FTC_GQueryRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
    FT_UInt      gindex;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
    FTC_Family   family;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
  } FTC_GQueryRec, *FTC_GQuery;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
#define FTC_GQUERY( x )  ( (FTC_GQuery)(x) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
  /* These functions are exported so that they can be called from          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
  /* user-provided cache classes; otherwise, they are really part of the   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
  /* cache sub-system internals.                                           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
  /* must be called by derived FTC_Node_InitFunc routines */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
  FTC_GNode_Init( FTC_GNode   node,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
                  FT_UInt     gindex,  /* glyph index for node */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
                  FTC_Family  family );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
#ifdef FTC_INLINE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
  /* returns TRUE iff the query's glyph index correspond to the node;  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
  /* this assumes that the `family' and `hash' fields of the query are */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
  /* already correctly set                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
  FT_LOCAL( FT_Bool )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
  FTC_GNode_Compare( FTC_GNode   gnode,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
                     FTC_GQuery  gquery,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
                     FTC_Cache   cache,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
                     FT_Bool*    list_changed );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
  /* call this function to clear a node's family -- this is necessary */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
  /* to implement the `node_remove_faceid' cache method correctly     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
  FTC_GNode_UnselectFamily( FTC_GNode  gnode,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
                            FTC_Cache  cache );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
  /* must be called by derived FTC_Node_DoneFunc routines */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
  FTC_GNode_Done( FTC_GNode  node,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
                  FTC_Cache  cache );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
  FTC_Family_Init( FTC_Family  family,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
                   FTC_Cache   cache );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
  typedef struct FTC_GCacheRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
    FTC_CacheRec    cache;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
    FTC_MruListRec  families;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
  } FTC_GCacheRec, *FTC_GCache;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
#define FTC_GCACHE( x )  ((FTC_GCache)(x))
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
#if 0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
  /* can be used as @FTC_Cache_InitFunc */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
  FT_LOCAL( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
  FTC_GCache_Init( FTC_GCache  cache );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
#if 0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
  /* can be used as @FTC_Cache_DoneFunc */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
  FTC_GCache_Done( FTC_GCache  cache );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
  /* the glyph cache class adds fields for the family implementation */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
  typedef struct  FTC_GCacheClassRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
    FTC_CacheClassRec  clazz;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
    FTC_MruListClass   family_class;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
  } FTC_GCacheClassRec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
  typedef const FTC_GCacheClassRec*   FTC_GCacheClass;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
#define FTC_GCACHE_CLASS( x )  ((FTC_GCacheClass)(x))
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
#define FTC_CACHE__GCACHE_CLASS( x ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
          FTC_GCACHE_CLASS( FTC_CACHE(x)->org_class )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
#define FTC_CACHE__FAMILY_CLASS( x ) \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
          ( (FTC_MruListClass)FTC_CACHE__GCACHE_CLASS( x )->family_class )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
  /* convenience function; use it instead of FTC_Manager_Register_Cache */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
  FT_LOCAL( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
  FTC_GCache_New( FTC_Manager       manager,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
                  FTC_GCacheClass   clazz,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
                  FTC_GCache       *acache );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
#ifndef FTC_INLINE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   261
  FT_LOCAL( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
  FTC_GCache_Lookup( FTC_GCache   cache,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
                     FT_PtrDist   hash,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
                     FT_UInt      gindex,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
                     FTC_GQuery   query,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
                     FTC_Node    *anode );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   267
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   268
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
  /* */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
#define FTC_FAMILY_FREE( family, cache )                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
          FTC_MruList_Remove( &FTC_GCACHE((cache))->families, \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
                              (FTC_MruNode)(family) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
#ifdef FTC_INLINE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash,                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
                               gindex, query, node, error )                 \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
  FT_BEGIN_STMNT                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
    FTC_GCache               _gcache   = FTC_GCACHE( cache );               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
    FTC_GQuery               _gquery   = (FTC_GQuery)( query );             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   285
    FTC_MruNode_CompareFunc  _fcompare = (FTC_MruNode_CompareFunc)(famcmp); \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
    FTC_MruNode              _mrunode;                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
                                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
                                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
    _gquery->gindex = (gindex);                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
                                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
    FTC_MRULIST_LOOKUP_CMP( &_gcache->families, _gquery, _fcompare,         \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
                            _mrunode, error );                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
    _gquery->family = FTC_FAMILY( _mrunode );                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
    if ( !error )                                                           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
    {                                                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
      FTC_Family  _gqfamily = _gquery->family;                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
                                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
                                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   299
      _gqfamily->num_nodes++;                                               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
                                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
      FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error );     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
                                                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
      if ( --_gqfamily->num_nodes == 0 )                                    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   304
        FTC_FAMILY_FREE( _gqfamily, _gcache );                              \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
    }                                                                       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
  FT_END_STMNT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   307
  /* */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   308
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   309
#else /* !FTC_INLINE */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   310
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   311
#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash,          \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   312
                               gindex, query, node, error )           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
   FT_BEGIN_STMNT                                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
                                                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   315
     error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex,    \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   316
                                FTC_GQUERY( query ), &node );         \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   317
                                                                      \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   318
   FT_END_STMNT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
#endif /* !FTC_INLINE */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   321
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   322
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   323
FT_END_HEADER
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   324
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   325
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   326
#endif /* __FTCGLYPH_H__ */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   327
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   328
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   329
/* END */