freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Devel] synchronization of bitmap access


From: Werner LEMBERG
Subject: [Devel] synchronization of bitmap access
Date: Tue, 01 Jul 2003 08:51:03 +0200 (CEST)

Dear friends,


I've just checked in another try of synchronizing the bitmap font
access in FreeType.  Below is the revised FT_Bitmap_Size structure
which has three new fields.

Please comment.  I've also appended some examples from ftdump (which
has been slightly updated also).


    Werner


======================================================================


app850.fon:

  There are 8 faces in this file.

  ----- Face number: 0 -----

  font name entries
     family:     Terminal
     style:      Regular
     postscript: UNAVAILABLE

  font type entries
     FreeType driver: winfonts
     sfnt wrapped:    no
     type:            fixed size
     direction:       horizontal
     fixed width:     yes
     glyph names:     no

  fixed size
       0: height 6, width 4
          size 15.000, x_ppem 20.000, y_ppem 20.000

  ...


mincho.ttc:

  There are 2 faces in this file.

  ----- Face number: 0 -----

  font name entries
     family:     MS Mincho
     style:      Regular
     postscript: MS-Mincho

  font type entries
     FreeType driver: truetype
     sfnt wrapped:    yes
     type:            scalable, fixed size
     direction:       horizontal, vertical
     fixed width:     no
     glyph names:     yes
     EM size:         256
     global BBox:     (0,-35):(255,220)
     ascent:          220
     descent:         -35
     text height:     255

  fixed size
       0: height 12, width 6
          size 12.000, x_ppem 12.000, y_ppem 12.000
       1: height 13, width 7
          size 13.000, x_ppem 13.000, y_ppem 13.000
       2: height 14, width 7
          size 14.000, x_ppem 14.000, y_ppem 14.000
       3: height 15, width 8
          size 15.000, x_ppem 15.000, y_ppem 15.000
       4: height 16, width 8
          size 16.000, x_ppem 16.000, y_ppem 16.000
       5: height 17, width 9
          size 17.000, x_ppem 17.000, y_ppem 17.000
       6: height 18, width 9
          size 18.000, x_ppem 18.000, y_ppem 18.000
       7: height 19, width 10
          size 19.000, x_ppem 19.000, y_ppem 19.000
       8: height 20, width 10
          size 20.000, x_ppem 20.000, y_ppem 20.000
       9: height 21, width 11
          size 21.000, x_ppem 21.000, y_ppem 21.000
      10: height 22, width 11
          size 22.000, x_ppem 22.000, y_ppem 22.000

  ...


8x13.bdf (from XFree86 4.3.0):

  There is 1 face in this file.

  ----- Face number: 0 -----

  font name entries
     family:     Fixed
     style:      Regular
     postscript: UNAVAILABLE

  font type entries
     FreeType driver: bdf
     sfnt wrapped:    no
     type:            fixed size
     direction:       horizontal
     fixed width:     yes
     glyph names:     no

  fixed size
       0: height 13, width 8
          size 11.953, x_ppem 12.453, y_ppem 12.453

  ...

       [The non-integer value for the size comes from the 72.27 -> 72
        points conversion.]


======================================================================


  /*************************************************************************/
  /*                                                                       */
  /* <Struct>                                                              */
  /*    FT_Bitmap_Size                                                     */
  /*                                                                       */
  /* <Description>                                                         */
  /*    This structure models the size of a bitmap strike (i.e., a bitmap  */
  /*    instance of the font for a given resolution) in a fixed-size font  */
  /*    face.  It is used for the `available_sizes' field of the           */
  /*    @FT_FaceRec structure.                                             */
  /*                                                                       */
  /* <Fields>                                                              */
  /*    height :: The (vertical) baseline-to-baseline distance in pixels.  */
  /*              It makes most sense to define the height of a bitmap     */
  /*              font in this way.                                        */
  /*                                                                       */
  /*    width  :: The average width of the font (in pixels).  Since the    */
  /*              algorithms to compute this value are different for the   */
  /*              various bitmap formats, it can only give an additional   */
  /*              hint if the `height' value isn't sufficient to select    */
  /*              the proper font.  For monospaced fonts the average width */
  /*              is the same as the maximum width.                        */
  /*                                                                       */
  /*    size   :: The point size in 26.6 fractional format this font shall */
  /*              represent (for a given vertical resolution).             */
  /*                                                                       */
  /*    x_ppem :: The horizontal ppem value (in 26.6 fractional format).   */
  /*                                                                       */
  /*    y_ppem :: The vertical ppem value (in 26.6 fractional format).     */
  /*                                                                       */
  /* <Note>                                                                */
  /*    The values in this structure are taken from the bitmap font.  If   */
  /*    the font doesn't provide a parameter it is set to zero to indicate */
  /*    that the information is not available.                             */
  /*                                                                       */
  /*    The following formula converts from dpi to ppem:                   */
  /*                                                                       */
  /*      ppem = size * dpi / 72                                           */
  /*                                                                       */
  /*    where `size' is in points.                                         */
  /*                                                                       */
  /*    Windows FNT:                                                       */
  /*      The `size', `x_ppem', and `y_ppem' parameters are not reliable:  */
  /*      There exist fonts (e.g. app850.fon) which have a wrong size for  */
  /*      some subfonts; since FNT files don't contain ppem but dpi values */
  /*      the computed x_ppem and y_ppem numbers are thus wrong also.      */
  /*                                                                       */
  /*    TrueType embedded bitmaps:                                         */
  /*      `size', `width', and `height' values are not contained in the    */
  /*      bitmap strike itself.  They are computed from the global font    */
  /*      parameters.                                                      */
  /*                                                                       */
  typedef struct  FT_Bitmap_Size_
  {
    FT_Short  height;
    FT_Short  width;

    FT_Pos    size;

    FT_Pos    x_ppem;
    FT_Pos    y_ppem;

  } FT_Bitmap_Size;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]