Chromium Code Reviews| Index: core/src/fxge/freetype/fx_freetype.c |
| diff --git a/core/src/fxge/freetype/fx_freetype.c b/core/src/fxge/freetype/fx_freetype.c |
| index 1ff2cc6d62bfea9aeff51e88c4b1e75f58f07a96..e83301b73c8df3135a3ca17cb85909452b3838b5 100644 |
| --- a/core/src/fxge/freetype/fx_freetype.c |
| +++ b/core/src/fxge/freetype/fx_freetype.c |
| @@ -8,8 +8,10 @@ |
| #include "third_party/freetype/src/psnames/pstables.h" |
| -static int xyq_search_node(char* glyph_name, int name_offset, int table_offset, wchar_t unicode) |
| -{ |
| +static int xyq_search_node(char* glyph_name, |
| + int name_offset, |
| + int table_offset, |
| + wchar_t unicode) { |
| int i, count; |
| // copy letters |
| @@ -26,18 +28,20 @@ static int xyq_search_node(char* glyph_name, int name_offset, int table_offset, |
| // check if we have value for this node |
| if (ft_adobe_glyph_list[table_offset] & 0x80) { |
| - unsigned short thiscode = ft_adobe_glyph_list[table_offset + 1] * 256 + ft_adobe_glyph_list[table_offset + 2]; |
| - if (thiscode == (unsigned short)unicode) // found it! |
| + unsigned short thiscode = ft_adobe_glyph_list[table_offset + 1] * 256 + |
| + ft_adobe_glyph_list[table_offset + 2]; |
| + if (thiscode == (unsigned short)unicode) |
| return 1; |
|
Lei Zhang
2016/02/24 01:37:01
wonky indentation
surprised this file didn't get
dsinclair
2016/02/24 14:51:08
Done. Could it be because it's .c?
|
| table_offset += 3; |
| - } |
| - else |
| + } else { |
| table_offset++; |
| + } |
| // now search in sub-nodes |
| if (count == 0) return 0; |
| for (i = 0; i < count; i++) { |
| - int child_offset = ft_adobe_glyph_list[table_offset + i * 2] * 256 + ft_adobe_glyph_list[table_offset + i * 2 + 1]; |
| + int child_offset = ft_adobe_glyph_list[table_offset + i * 2] * 256 + |
| + ft_adobe_glyph_list[table_offset + i * 2 + 1]; |
| if (xyq_search_node(glyph_name, name_offset, child_offset, unicode)) |
| // found in child |
| return 1; |
| @@ -47,14 +51,10 @@ static int xyq_search_node(char* glyph_name, int name_offset, int table_offset, |
| #define VARIANT_BIT 0x80000000UL |
| -int FXFT_unicode_from_adobe_name(const char* glyph_name) |
| -{ |
| +int FXFT_unicode_from_adobe_name(const char* glyph_name) { |
| /* If the name begins with `uni', then the glyph name may be a */ |
| /* hard-coded unicode character code. */ |
| - if (glyph_name[0] == 'u' && |
| - glyph_name[1] == 'n' && |
| - glyph_name[2] == 'i') |
| - { |
| + if (glyph_name[0] == 'u' && glyph_name[1] == 'n' && glyph_name[2] == 'i') { |
| /* determine whether the next four characters following are */ |
| /* hexadecimal. */ |
| @@ -65,16 +65,13 @@ int FXFT_unicode_from_adobe_name(const char* glyph_name) |
| FT_UInt32 value = 0; |
| const char* p = glyph_name + 3; |
| - |
| - for (count = 4; count > 0; count--, p++) |
| - { |
| + for (count = 4; count > 0; count--, p++) { |
| char c = *p; |
| unsigned int d; |
| d = (unsigned char)c - '0'; |
| - if (d >= 10) |
| - { |
| + if (d >= 10) { |
| d = (unsigned char)c - 'A'; |
| if (d >= 6) |
| d = 16; |
| @@ -92,8 +89,7 @@ int FXFT_unicode_from_adobe_name(const char* glyph_name) |
| } |
| /* there must be exactly four hex digits */ |
| - if (count == 0) |
| - { |
| + if (count == 0) { |
| if (*p == '\0') |
| return value; |
| if (*p == '.') |
| @@ -103,22 +99,18 @@ int FXFT_unicode_from_adobe_name(const char* glyph_name) |
| /* If the name begins with `u', followed by four to six uppercase */ |
| /* hexadecimal digits, it is a hard-coded unicode character code. */ |
| - if (glyph_name[0] == 'u') |
| - { |
| + if (glyph_name[0] == 'u') { |
| FT_Int count; |
| FT_UInt32 value = 0; |
| const char* p = glyph_name + 1; |
| - |
| - for (count = 6; count > 0; count--, p++) |
| - { |
| + for (count = 6; count > 0; count--, p++) { |
| char c = *p; |
| unsigned int d; |
| d = (unsigned char)c - '0'; |
| - if (d >= 10) |
| - { |
| + if (d >= 10) { |
| d = (unsigned char)c - 'A'; |
| if (d >= 6) |
| d = 16; |
| @@ -132,8 +124,7 @@ int FXFT_unicode_from_adobe_name(const char* glyph_name) |
| value = (value << 4) + d; |
| } |
| - if (count <= 2) |
| - { |
| + if (count <= 2) { |
| if (*p == '\0') |
| return value; |
| if (*p == '.') |
| @@ -147,11 +138,8 @@ int FXFT_unicode_from_adobe_name(const char* glyph_name) |
| const char* p = glyph_name; |
| const char* dot = NULL; |
| - |
| - for (; *p; p++) |
| - { |
| - if (*p == '.' && p > glyph_name) |
| - { |
| + for (; *p; p++) { |
| + if (*p == '.' && p > glyph_name) { |
| dot = p; |
| break; |
| } |
| @@ -166,14 +154,14 @@ int FXFT_unicode_from_adobe_name(const char* glyph_name) |
| } |
| } |
| -void FXFT_adobe_name_from_unicode(char* glyph_name, wchar_t unicode) |
| -{ |
| +void FXFT_adobe_name_from_unicode(char* glyph_name, wchar_t unicode) { |
| int i, count; |
| // start from top level node |
| count = ft_adobe_glyph_list[1]; |
| for (i = 0; i < count; i++) { |
| - int child_offset = ft_adobe_glyph_list[i * 2 + 2] * 256 + ft_adobe_glyph_list[i * 2 + 3]; |
| + int child_offset = |
| + ft_adobe_glyph_list[i * 2 + 2] * 256 + ft_adobe_glyph_list[i * 2 + 3]; |
| if (xyq_search_node(glyph_name, 0, child_offset, unicode)) |
| return; |
| } |