tor-browser

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

afadjust.h (5078B)


      1 /****************************************************************************
      2 *
      3 * afadjust.h
      4 *
      5 *   Auto-fitter routines to adjust components based on charcode (header).
      6 *
      7 * Copyright (C) 2023-2025 by
      8 * David Turner, Robert Wilhelm, and Werner Lemberg.
      9 *
     10 * Written by Craig White <gerzytet@gmail.com>.
     11 *
     12 * This file is part of the FreeType project, and may only be used,
     13 * modified, and distributed under the terms of the FreeType project
     14 * license, LICENSE.TXT.  By continuing to use, modify, or distribute
     15 * this file you indicate that you have read the license and
     16 * understand and accept it fully.
     17 *
     18 */
     19 
     20 
     21 #ifndef AFADJUST_H_
     22 #define AFADJUST_H_
     23 
     24 #include <freetype/fttypes.h>
     25 
     26 #include "afglobal.h"
     27 #include "aftypes.h"
     28 
     29 
     30 FT_BEGIN_HEADER
     31 
     32  /*
     33   * Adjustment type flags.
     34   *
     35   * They also specify topological constraints that the auto-hinter relies
     36   * on.  For example, using `AF_ADJUST_UP` implies that we have two
     37   * enclosing contours, one for the base glyph and one for the diacritic
     38   * above, and no other contour inbetween or above.  With 'enclosing' it is
     39   * meant that such a contour can contain more inner contours.
     40   *
     41   */
     42 
     43  /* Find the topmost contour and push it up until its lowest point is */
     44  /* one pixel above the highest point not enclosed by that contour.   */
     45 #define AF_ADJUST_UP  0x01
     46 
     47  /* Find the bottommost contour and push it down until its highest point */
     48  /* is one pixel below the lowest point not enclosed by that contour.    */
     49 #define AF_ADJUST_DOWN  0x02
     50 
     51  /* Find the contour below the topmost contour and push it up, together */
     52  /* with the topmost contour, until its lowest point is one pixel above */
     53  /* the highest point not enclosed by that contour.  This flag is       */
     54  /* mutually exclusive with `AF_ADJUST_UP`.                             */
     55 #define AF_ADJUST_UP2  0x04
     56 
     57  /* Find the contour above the bottommost contour and push it down,  */
     58  /* together with the bottommost contour, until its highest point is */
     59  /* one pixel below the lowest point not enclosed by that contour.   */
     60  /* This flag is mutually exclusive with `AF_ADJUST_DOWN`.           */
     61 #define AF_ADJUST_DOWN2  0x08
     62 
     63  /* The topmost contour is a tilde.  Enlarge it vertically so that it    */
     64  /* stays legible at small sizes, not degenerating to a horizontal line. */
     65 #define AF_ADJUST_TILDE_TOP  0x10
     66 
     67  /* The bottommost contour is a tilde.  Enlarge it vertically so that it */
     68  /* stays legible at small sizes, not degenerating to a horizontal line. */
     69 #define AF_ADJUST_TILDE_BOTTOM  0x20
     70 
     71  /* The contour below the topmost contour is a tilde.  Enlarge it        */
     72  /* vertically so that it stays legible at small sizes, not degenerating */
     73  /* to a horizontal line.  To be used with `AF_ADJUST_UP2` only.         */
     74 #define AF_ADJUST_TILDE_TOP2  0x40
     75 
     76  /* The contour above the bottommost contour is a tilde.  Enlarge it     */
     77  /* vertically so that it stays legible at small sizes, not degenerating */
     78  /* to a horizontal line.  To be used with `AF_ADJUST_DOWN2` only.       */
     79 #define AF_ADJUST_TILDE_BOTTOM2  0x80
     80 
     81  /* Make the auto-hinter ignore any diacritic (either a separate contour */
     82  /* or part of the base character outline) that is attached to the top   */
     83  /* of an uppercase base character.                                      */
     84 #define AF_IGNORE_CAPITAL_TOP  0x100
     85 
     86  /* Make the auto-hinter ignore any diacritic (either a separate contour */
     87  /* or part of the base character outline) that is attached to the       */
     88  /* bottom of an uppercase base character.                               */
     89 #define AF_IGNORE_CAPITAL_BOTTOM  0x200
     90 
     91  /* Make the auto-hinter ignore any diacritic (either a separate contour */
     92  /* or part of the base character outline) that is attached to the top   */
     93  /* of a lowercase base character.                                       */
     94 #define AF_IGNORE_SMALL_TOP  0x400
     95 
     96  /* Make the auto-hinter ignore any diacritic (either a separate contour */
     97  /* or part of the base character outline) that is attached to the       */
     98  /* bottom of a lowercase base character.                                */
     99 #define AF_IGNORE_SMALL_BOTTOM  0x800
    100 
    101  /* By default, the AF_ADJUST_XXX flags are applied only if diacritics */
    102  /* have a 'small' height (based on some heuristic checks).  If this   */
    103  /* flag is set, no such check is performed.                           */
    104 #define AF_ADJUST_NO_HEIGHT_CHECK  0x1000
    105 
    106  /* No adjustment, i.e., no flag is set. */
    107 #define AF_ADJUST_NONE  0x00
    108 
    109 
    110  FT_LOCAL( FT_UInt32 )
    111  af_adjustment_database_lookup( FT_UInt32  codepoint );
    112 
    113  /* Allocate and populate the reverse character map, */
    114  /* using the character map within the face.         */
    115  FT_LOCAL( FT_Error )
    116  af_reverse_character_map_new( FT_Hash         *map,
    117                                AF_StyleMetrics  metrics );
    118 
    119  /* Free the reverse character map. */
    120  FT_LOCAL( FT_Error )
    121  af_reverse_character_map_done( FT_Hash    map,
    122                                 FT_Memory  memory );
    123 
    124 
    125 FT_END_HEADER
    126 
    127 #endif /* AFADJUST_H_ */
    128 
    129 
    130 /* END */