summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/base/ftsnames.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/freetype/src/base/ftsnames.c')
-rw-r--r--src/3rdparty/freetype/src/base/ftsnames.c60
1 files changed, 57 insertions, 3 deletions
diff --git a/src/3rdparty/freetype/src/base/ftsnames.c b/src/3rdparty/freetype/src/base/ftsnames.c
index 80304e5c85..90ea1e2be7 100644
--- a/src/3rdparty/freetype/src/base/ftsnames.c
+++ b/src/3rdparty/freetype/src/base/ftsnames.c
@@ -7,7 +7,7 @@
/* */
/* This is _not_ used to retrieve glyph names! */
/* */
-/* Copyright 1996-2015 by */
+/* Copyright 1996-2018 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -20,6 +20,8 @@
#include <ft2build.h>
+#include FT_INTERNAL_DEBUG_H
+
#include FT_SFNT_NAMES_H
#include FT_INTERNAL_TRUETYPE_TYPES_H
#include FT_INTERNAL_STREAM_H
@@ -54,11 +56,11 @@
if ( idx < (FT_UInt)ttface->num_names )
{
- TT_NameEntryRec* entry = ttface->name_table.names + idx;
+ TT_Name entry = ttface->name_table.names + idx;
/* load name on demand */
- if ( entry->stringLength > 0 && entry->string == NULL )
+ if ( entry->stringLength > 0 && !entry->string )
{
FT_Memory memory = face->memory;
FT_Stream stream = face->stream;
@@ -88,6 +90,58 @@
}
+ /* documentation is in ftsnames.h */
+
+ FT_EXPORT_DEF( FT_Error )
+ FT_Get_Sfnt_LangTag( FT_Face face,
+ FT_UInt langID,
+ FT_SfntLangTag *alangTag )
+ {
+ FT_Error error = FT_ERR( Invalid_Argument );
+
+
+ if ( alangTag && face && FT_IS_SFNT( face ) )
+ {
+ TT_Face ttface = (TT_Face)face;
+
+
+ if ( ttface->name_table.format != 1 )
+ return FT_THROW( Invalid_Table );
+
+ if ( langID > 0x8000U &&
+ langID - 0x8000U < ttface->name_table.numLangTagRecords )
+ {
+ TT_LangTag entry = ttface->name_table.langTags +
+ ( langID - 0x8000U );
+
+
+ /* load name on demand */
+ if ( entry->stringLength > 0 && !entry->string )
+ {
+ FT_Memory memory = face->memory;
+ FT_Stream stream = face->stream;
+
+
+ if ( FT_NEW_ARRAY ( entry->string, entry->stringLength ) ||
+ FT_STREAM_SEEK( entry->stringOffset ) ||
+ FT_STREAM_READ( entry->string, entry->stringLength ) )
+ {
+ FT_FREE( entry->string );
+ entry->stringLength = 0;
+ }
+ }
+
+ alangTag->string = (FT_Byte*)entry->string;
+ alangTag->string_len = entry->stringLength;
+
+ error = FT_Err_Ok;
+ }
+ }
+
+ return error;
+ }
+
+
#endif /* TT_CONFIG_OPTION_SFNT_NAMES */