freetype-devel
[Top][All Lists]
Advanced

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

[Devel] BUG report: CJK - can't get SFNT correctly


From: Mike A. Harris
Subject: [Devel] BUG report: CJK - can't get SFNT correctly
Date: Sun, 2 Sep 2001 03:24:54 -0400 (EDT)

THe following bug was reported in our bugzilla database.  I'm 
sending this upstream so someone with a deeper knowledge of 
TrueType can look into it, advise, etc..

------------------------------------------------------------------

Description of problem:
when the TrueType font has some language ID, freetype library 
can't return
the SFNT correctly.

How reproducible:
Always

Steps to Reproduce:
1.compile a sample code. (gcc -o fttest `freetype-config --cflags 
--libs`
fttest.c
2../fttest /usr/share/fonts/ja/TrueType/kochi-gothic.ttf
3.see also a log.
        

Actual Results:  
filename: /usr/share/fonts/ja/TrueType/kochi-gothic.ttf
index: 0
name_id: 4
language_id: 0
string: Kochi Gothic
index: 1
name_id: 0
language_id: 1041
string: XXXX
index: 2
name_id: 1
language_id: 1041
string: Kochi Gothic
index: 3
name_id: 2
language_id: 1041
string: Regular
index: 4
name_id: 3
language_id: 1041
string: Kochi Gothic
index: 5
name_id: 4
language_id: 1041
string: Kochi Gothic
index: 6
name_id: 5
language_id: 1041
string: Version 0.00
index: 7
name_id: 6
language_id: 1041
string: Kochi-Gothic
index: 8
name_id: 7
language_id: 1041
string: Kochi

-------------------------------------------------------------

Sample app:

#include <stdio.h>
#include <string.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_TRUETYPE_IDS_H
#include FT_SFNT_NAMES_H

FT_Library ftlib;
FT_Error fterr;

int main (int argc, char **argv)
{
        FT_Face face;
        FT_SfntName sn;
        char *name;
        int i;

        fterr = FT_Init_FreeType (&ftlib);
        if (fterr) {
                printf ("an error occurred during library initialization.\n");
                exit (1);
        }
        printf ("filename: %s\n", argv[1]);
        fterr = FT_New_Face (ftlib, argv[1], 0, &face);
        if (fterr == FT_Err_Unknown_File_Format) {
                printf ("Unknown file format.\n");
                exit (1);
        }
        else if (fterr) {
                printf ("FreeType error -- %d\n", fterr);
                exit (1);
        }
        for (i = 0; i < 9; i++) {
        fterr = FT_Get_Sfnt_Name (face, i, &sn);
                if (fterr != FT_Err_Ok) {
                        printf ("Can't get psname -- %d\n", fterr);
                        exit (1);
                }
                name = (char *)malloc (sizeof (char) * sn.string_len + 1);
                strncpy (name, sn.string, sn.string_len);
                name[sn.string_len] = 0;
                printf ("index: %d\n", i);
                printf ("name_id: %d\n", sn.name_id);
                printf ("language_id: %d\n", sn.language_id);
                printf ("string: %s\n", name);
                free (name);
        }
        FT_Done_Face (face);
        FT_Done_FreeType (ftlib);

        return 0;
}



TTYL



----------------------------------------------------------------------
Mike A. Harris                  Shipping/mailing address:
OS Systems Engineer             190 Pittsburgh Ave., Sault Ste. Marie,
XFree86 maintainer              Ontario, Canada, P6C 5B3
Red Hat Inc.                    Phone: (705)949-2136
http://www.redhat.com           ftp://people.redhat.com/mharris

Red Hat XFree86 mailing list:   address@hidden
IRC:  #redhat-xfree86 on irc.openprojects.org
----------------------------------------------------------------------




reply via email to

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