From 16188ebfac8f179bfeb32a6a3147b4264516bc79 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 3 Dec 2014 10:18:34 +0100 Subject: [PATCH] FT_Sfnt_Tag: s/ft_sfnt_xxx/FT_SFNT_XXX/ for orthogonality. All public FreeType enumeration and flag values are uppercase... * include/tttables.h (FT_Sfnt_Tag): Implement it. For backwards compatilibity, retain the old values as macros. * src/base/ftfstype.c (FT_Get_FSType_Flags), src/sfnt/sfdriver.c (get_sfnt_table): Updated. --- ChangeLog | 12 ++++++++++++ include/tttables.h | 43 ++++++++++++++++++++++++++++++++++--------- src/base/ftfstype.c | 4 ++-- src/sfnt/sfdriver.c | 22 +++++++++++----------- 4 files changed, 59 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c83a521a..8cc45ea3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2014-12-03 Werner Lemberg + + FT_Sfnt_Tag: s/ft_sfnt_xxx/FT_SFNT_XXX/ for orthogonality. + + All public FreeType enumeration and flag values are uppercase... + + * include/tttables.h (FT_Sfnt_Tag): Implement it. For backwards + compatilibity, retain the old values as macros. + + * src/base/ftfstype.c (FT_Get_FSType_Flags), src/sfnt/sfdriver.c + (get_sfnt_table): Updated. + 2014-12-02 Werner Lemberg * include/*: Improve structure of documentation. diff --git a/include/tttables.h b/include/tttables.h index 164d821b4..e1d8b05e7 100644 --- a/include/tttables.h +++ b/include/tttables.h @@ -578,20 +578,45 @@ FT_BEGIN_HEADER /* An enumeration used to specify the index of an SFNT table. */ /* Used in the @FT_Get_Sfnt_Table API function. */ /* */ + /* */ + /* FT_SFNT_HEAD :: To access the font's @TT_Header structure. */ + /* */ + /* FT_SFNT_MAXP :: To access the font's @TT_MaxProfile structure. */ + /* */ + /* FT_SFNT_OS2 :: To access the font's @TT_OS2 structure. */ + /* */ + /* FT_SFNT_HHEA :: To access the font's @TT_HoriHeader structure. */ + /* */ + /* FT_SFNT_VHEA :: To access the font's @TT_VertHeader struture. */ + /* */ + /* FT_SFNT_POST :: To access the font's @TT_Postscript structure. */ + /* */ + /* FT_SFNT_PCLT :: To access the font's @TT_PCLT structure. */ + /* */ typedef enum FT_Sfnt_Tag_ { - ft_sfnt_head = 0, /* TT_Header */ - ft_sfnt_maxp = 1, /* TT_MaxProfile */ - ft_sfnt_os2 = 2, /* TT_OS2 */ - ft_sfnt_hhea = 3, /* TT_HoriHeader */ - ft_sfnt_vhea = 4, /* TT_VertHeader */ - ft_sfnt_post = 5, /* TT_Postscript */ - ft_sfnt_pclt = 6, /* TT_PCLT */ + FT_SFNT_HEAD, + FT_SFNT_MAXP, + FT_SFNT_OS2, + FT_SFNT_HHEA, + FT_SFNT_VHEA, + FT_SFNT_POST, + FT_SFNT_PCLT, - sfnt_max /* internal end mark */ + FT_SFNT_MAX } FT_Sfnt_Tag; + /* these constants are deprecated; use the corresponding `FT_Sfnt_Tag' */ + /* values instead */ +#define ft_sfnt_head FT_SFNT_HEAD +#define ft_sfnt_maxp FT_SFNT_MAXP +#define ft_sfnt_os2 FT_SFNT_OS2 +#define ft_sfnt_hhea FT_SFNT_HHEA +#define ft_sfnt_vhea FT_SFNT_VHEA +#define ft_sfnt_post FT_SFNT_POST +#define ft_sfnt_pclt FT_SFNT_PCLT + /*************************************************************************/ /* */ @@ -628,7 +653,7 @@ FT_BEGIN_HEADER /* */ /* */ /* vert_header = */ - /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, ft_sfnt_vhea ); */ + /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, FT_SFNT_VHEA ); */ /* } */ /* */ FT_EXPORT( void* ) diff --git a/src/base/ftfstype.c b/src/base/ftfstype.c index d0ef7b7c1..6b49ef837 100644 --- a/src/base/ftfstype.c +++ b/src/base/ftfstype.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file to access FSType data (body). */ /* */ -/* Copyright 2008, 2009 by */ +/* Copyright 2008, 2009, 2014 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -51,7 +51,7 @@ /* look at FSType before fsType for Type42 */ - if ( ( os2 = (TT_OS2*)FT_Get_Sfnt_Table( face, ft_sfnt_os2 ) ) != NULL && + if ( ( os2 = (TT_OS2*)FT_Get_Sfnt_Table( face, FT_SFNT_OS2 ) ) != NULL && os2->version != 0xFFFFU ) return os2->fsType; diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index e4fcda5ec..bd8dd2e57 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -75,36 +75,36 @@ switch ( tag ) { - case ft_sfnt_head: + case FT_SFNT_HEAD: table = &face->header; break; - case ft_sfnt_hhea: + case FT_SFNT_HHEA: table = &face->horizontal; break; - case ft_sfnt_vhea: - table = face->vertical_info ? &face->vertical : 0; + case FT_SFNT_VHEA: + table = face->vertical_info ? &face->vertical : NULL; break; - case ft_sfnt_os2: - table = face->os2.version == 0xFFFFU ? 0 : &face->os2; + case FT_SFNT_OS2: + table = face->os2.version == 0xFFFFU ? NULL : &face->os2; break; - case ft_sfnt_post: + case FT_SFNT_POST: table = &face->postscript; break; - case ft_sfnt_maxp: + case FT_SFNT_MAXP: table = &face->max_profile; break; - case ft_sfnt_pclt: - table = face->pclt.Version ? &face->pclt : 0; + case FT_SFNT_PCLT: + table = face->pclt.Version ? &face->pclt : NULL; break; default: - table = 0; + table = NULL; } return table;