tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

afblue.hin (5369B)


      1 /****************************************************************************
      2  *
      3  * afblue.h
      4  *
      5  *   Auto-fitter data for blue strings (specification).
      6  *
      7  * Copyright (C) 2013-2025 by
      8  * David Turner, Robert Wilhelm, and Werner Lemberg.
      9  *
     10  * This file is part of the FreeType project, and may only be used,
     11  * modified, and distributed under the terms of the FreeType project
     12  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
     13  * this file you indicate that you have read the license and
     14  * understand and accept it fully.
     15  *
     16  */
     17 
     18 
     19 #ifndef AFBLUE_H_
     20 #define AFBLUE_H_
     21 
     22 
     23 FT_BEGIN_HEADER
     24 
     25 
     26   /* an auxiliary macro to decode a UTF-8 character -- since we only use */
     27   /* hard-coded, self-converted data, no error checking is performed     */
     28 #define GET_UTF8_CHAR( ch, p )                      \
     29           do                                        \
     30           {                                         \
     31             ch = (unsigned char)*p++;               \
     32             if ( ch >= 0x80 )                       \
     33             {                                       \
     34               FT_UInt  len_;                        \
     35                                                     \
     36                                                     \
     37               if ( ch < 0xE0 )                      \
     38               {                                     \
     39                 len_ = 1;                           \
     40                 ch  &= 0x1F;                        \
     41               }                                     \
     42               else if ( ch < 0xF0 )                 \
     43               {                                     \
     44                 len_ = 2;                           \
     45                 ch  &= 0x0F;                        \
     46               }                                     \
     47               else                                  \
     48               {                                     \
     49                 len_ = 3;                           \
     50                 ch  &= 0x07;                        \
     51               }                                     \
     52                                                     \
     53               for ( ; len_ > 0; len_-- )            \
     54                 ch = ( ch << 6 ) | ( *p++ & 0x3F ); \
     55             }                                       \
     56           } while ( 0 )
     57 
     58 
     59   /*************************************************************************/
     60   /*************************************************************************/
     61   /*****                                                               *****/
     62   /*****                    B L U E   S T R I N G S                    *****/
     63   /*****                                                               *****/
     64   /*************************************************************************/
     65   /*************************************************************************/
     66 
     67   /* At the bottommost level, we define strings for finding blue zones. */
     68 
     69 
     70 #define AF_BLUE_STRING_MAX_LEN  @AF_BLUE_STRING_MAX_LEN@
     71 
     72   /* The AF_Blue_String enumeration values are offsets into the */
     73   /* `af_blue_strings' array.                                   */
     74 
     75   typedef enum  AF_Blue_String_
     76   {
     77 @AF_BLUE_STRING_ENUM@
     78 
     79     AF_BLUE_STRING_MAX   /* do not remove */
     80 
     81   } AF_Blue_String;
     82 
     83 
     84   FT_LOCAL_ARRAY( char )
     85   af_blue_strings[];
     86 
     87 
     88   /*************************************************************************/
     89   /*************************************************************************/
     90   /*****                                                               *****/
     91   /*****                 B L U E   S T R I N G S E T S                 *****/
     92   /*****                                                               *****/
     93   /*************************************************************************/
     94   /*************************************************************************/
     95 
     96   /* The next level is to group blue strings into style-specific sets. */
     97 
     98 
     99   /* Properties are specific to a writing system.  We assume that a given  */
    100   /* blue string can't be used in more than a single writing system, which */
    101   /* is a safe bet.                                                        */
    102 #define AF_BLUE_PROPERTY_LATIN_TOP       ( 1U << 0 )    /* must be value 1 */
    103 #define AF_BLUE_PROPERTY_LATIN_SUB_TOP   ( 1U << 1 )
    104 #define AF_BLUE_PROPERTY_LATIN_NEUTRAL   ( 1U << 2 )
    105 #define AF_BLUE_PROPERTY_LATIN_X_HEIGHT  ( 1U << 3 )
    106 #define AF_BLUE_PROPERTY_LATIN_LONG      ( 1U << 4 )
    107 
    108 #define AF_BLUE_PROPERTY_LATIN_CAPITAL_BOTTOM  ( 1U << 5 )
    109 #define AF_BLUE_PROPERTY_LATIN_SMALL_BOTTOM    ( 1U << 6 )
    110 
    111 #define AF_BLUE_PROPERTY_CJK_TOP    ( 1U << 0 )         /* must be value 1 */
    112 #define AF_BLUE_PROPERTY_CJK_HORIZ  ( 1U << 1 )         /* must be value 2 */
    113 #define AF_BLUE_PROPERTY_CJK_RIGHT  AF_BLUE_PROPERTY_CJK_TOP
    114 
    115 
    116 #define AF_BLUE_STRINGSET_MAX_LEN  @AF_BLUE_STRINGSET_MAX_LEN@
    117 
    118   /* The AF_Blue_Stringset enumeration values are offsets into the */
    119   /* `af_blue_stringsets' array.                                   */
    120 
    121   typedef enum  AF_Blue_Stringset_
    122   {
    123 @AF_BLUE_STRINGSET_ENUM@
    124 
    125     AF_BLUE_STRINGSET_MAX   /* do not remove */
    126 
    127   } AF_Blue_Stringset;
    128 
    129 
    130   typedef struct  AF_Blue_StringRec_
    131   {
    132     AF_Blue_String  string;
    133     FT_UShort       properties;
    134 
    135   } AF_Blue_StringRec;
    136 
    137 
    138   FT_LOCAL_ARRAY( AF_Blue_StringRec )
    139   af_blue_stringsets[];
    140 
    141 /* */
    142 
    143 FT_END_HEADER
    144 
    145 
    146 #endif /* AFBLUE_H_ */
    147 
    148 
    149 /* END */