freetype
[Top][All Lists]
Advanced

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

WinFNT driver - undefined char index 0...


From: Boris Letocha
Subject: WinFNT driver - undefined char index 0...
Date: Tue, 18 Jul 2000 08:16:49 +0200

Hi!

I am very happy that my changes are applied to CVS ...
So there is my next proposal for change (in WinFNT driver): (default char
have char index 0)

  static
  FT_UInt  FNT_Get_Char_Index( FT_CharMap  charmap,
                               FT_ULong    char_code )
  {
    FT_UInt  result = char_code;


    if ( charmap )
    {
      FNT_Font*  font  = ((FNT_Face)charmap->face)->fonts;
      FT_UInt    first = font->header.first_char;
      FT_UInt    count = font->header.last_char - first + 1;

// begin of changed lines
      char_code -= first;
      if ( char_code < count )
        result = char_code + 1;
      else
        result = 0;
// end of changed lines
    }

    return result;
  }

  static
  FT_Error  FNT_Load_Glyph( FT_GlyphSlot  slot,
                            FNT_Size      size,
                            FT_UInt       glyph_index,
                            FT_Int        load_flags )
  {
    FNT_Font*   font  = size->font;
    FT_Error    error = 0;
    FT_Byte*    p;
    FT_Int      len;
    FT_Bitmap*  bitmap = &slot->bitmap;
    FT_ULong    offset;
    FT_Bool     new_format;

    FT_UNUSED( slot );
    FT_UNUSED( load_flags );


    if ( !font )
    {
      error = FT_Err_Invalid_Argument;
      goto Exit;
    }

// added lines
    if (glyph_index>0)
    {
      glyph_index--;
    }
    else
    {
      glyph_index=font->header.default_char-font->header.first_char;
    }
// end of added lines

Happy codding ...

Boris Letocha



reply via email to

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