diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2016-02-24 13:20:42 -0500 |
---|---|---|
committer | Dan Sinclair <dsinclair@chromium.org> | 2016-02-24 13:20:42 -0500 |
commit | d826067558d2397cb279ab941a2dc088f0cd7a4b (patch) | |
tree | 1fc225fad4e9cbe1482ba2aa36ea13ce7471c84a /core/src | |
parent | f3e685179ab248bdde01a240096d36ff6a21ee8f (diff) | |
download | pdfium-d826067558d2397cb279ab941a2dc088f0cd7a4b.tar.xz |
Rename fxge .c files to .cpp
Renaming these files will allow them to be picked up by git cl format and the
linter.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1733653002 .
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitDingbats.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitDingbats.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitFixed.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitFixed.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitFixedItalic.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitFixedItalic.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitSans.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitSans.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitSansBold.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitSansBold.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitSansItalic.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitSansItalic.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitSansMM.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitSansMM.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitSerif.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitSerif.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitSerifBold.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitSerifBold.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitSerifItalic.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitSerifItalic.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitSerifMM.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitSerifMM.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/fontdata/chromefontdata/FoxitSymbol.cpp (renamed from core/src/fxge/fontdata/chromefontdata/FoxitSymbol.c) | 0 | ||||
-rw-r--r-- | core/src/fxge/freetype/fx_freetype.c | 170 | ||||
-rw-r--r-- | core/src/fxge/freetype/fx_freetype.cpp | 170 |
18 files changed, 170 insertions, 170 deletions
diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitDingbats.c b/core/src/fxge/fontdata/chromefontdata/FoxitDingbats.cpp index 47950979a3..47950979a3 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitDingbats.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitDingbats.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitFixed.c b/core/src/fxge/fontdata/chromefontdata/FoxitFixed.cpp index bbd1525db6..bbd1525db6 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitFixed.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitFixed.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.c b/core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.cpp index 58df84debe..58df84debe 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitFixedBold.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.c b/core/src/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.cpp index d6de9f6006..d6de9f6006 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitFixedItalic.c b/core/src/fxge/fontdata/chromefontdata/FoxitFixedItalic.cpp index 905e7bbc5c..905e7bbc5c 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitFixedItalic.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitFixedItalic.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSans.c b/core/src/fxge/fontdata/chromefontdata/FoxitSans.cpp index 26cd319403..26cd319403 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSans.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSans.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSansBold.c b/core/src/fxge/fontdata/chromefontdata/FoxitSansBold.cpp index 8b185f50c4..8b185f50c4 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSansBold.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSansBold.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.c b/core/src/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.cpp index 884c6ebdf6..884c6ebdf6 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSansItalic.c b/core/src/fxge/fontdata/chromefontdata/FoxitSansItalic.cpp index 9e1b558340..9e1b558340 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSansItalic.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSansItalic.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSansMM.c b/core/src/fxge/fontdata/chromefontdata/FoxitSansMM.cpp index 3cc6ef8d1e..3cc6ef8d1e 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSansMM.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSansMM.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSerif.c b/core/src/fxge/fontdata/chromefontdata/FoxitSerif.cpp index 57e70dc0b9..57e70dc0b9 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSerif.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSerif.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSerifBold.c b/core/src/fxge/fontdata/chromefontdata/FoxitSerifBold.cpp index ee481beba5..ee481beba5 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSerifBold.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSerifBold.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.c b/core/src/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.cpp index e3eea02753..e3eea02753 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSerifItalic.c b/core/src/fxge/fontdata/chromefontdata/FoxitSerifItalic.cpp index e13edf995e..e13edf995e 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSerifItalic.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSerifItalic.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSerifMM.c b/core/src/fxge/fontdata/chromefontdata/FoxitSerifMM.cpp index 5180d10912..5180d10912 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSerifMM.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSerifMM.cpp diff --git a/core/src/fxge/fontdata/chromefontdata/FoxitSymbol.c b/core/src/fxge/fontdata/chromefontdata/FoxitSymbol.cpp index c9681b2c5a..c9681b2c5a 100644 --- a/core/src/fxge/fontdata/chromefontdata/FoxitSymbol.c +++ b/core/src/fxge/fontdata/chromefontdata/FoxitSymbol.cpp diff --git a/core/src/fxge/freetype/fx_freetype.c b/core/src/fxge/freetype/fx_freetype.c deleted file mode 100644 index a3f092284a..0000000000 --- a/core/src/fxge/freetype/fx_freetype.c +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "core/include/fxge/fx_freetype.h" - -#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) { - int i, count; - - // copy letters - while (1) { - glyph_name[name_offset] = ft_adobe_glyph_list[table_offset] & 0x7f; - name_offset++; - table_offset++; - if (!(ft_adobe_glyph_list[table_offset - 1] & 0x80)) break; - } - glyph_name[name_offset] = 0; - - // get child count - count = ft_adobe_glyph_list[table_offset] & 0x7f; - - // 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) - return 1; - table_offset += 3; - } 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]; - if (xyq_search_node(glyph_name, name_offset, child_offset, unicode)) - return 1; - } - return 0; -} - -#define VARIANT_BIT 0x80000000UL - -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') { - /* determine whether the next four characters following are */ - /* hexadecimal. */ - - /* XXX: Add code to deal with ligatures, i.e. glyph names like */ - /* `uniXXXXYYYYZZZZ'... */ - - FT_Int count; - FT_UInt32 value = 0; - const char* p = glyph_name + 3; - - for (count = 4; count > 0; count--, p++) { - char c = *p; - unsigned int d; - - - d = (unsigned char)c - '0'; - if (d >= 10) { - d = (unsigned char)c - 'A'; - if (d >= 6) - d = 16; - else - d += 10; - } - - /* Exit if a non-uppercase hexadecimal character was found */ - /* -- this also catches character codes below `0' since such */ - /* negative numbers cast to `unsigned int' are far too big. */ - if (d >= 16) - break; - - value = (value << 4) + d; - } - - /* there must be exactly four hex digits */ - if (count == 0) { - if (*p == '\0') - return value; - if (*p == '.') - return (FT_UInt32)(value | VARIANT_BIT); - } - } - - /* 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') { - FT_Int count; - FT_UInt32 value = 0; - const char* p = glyph_name + 1; - - for (count = 6; count > 0; count--, p++) { - char c = *p; - unsigned int d; - - - d = (unsigned char)c - '0'; - if (d >= 10) { - d = (unsigned char)c - 'A'; - if (d >= 6) - d = 16; - else - d += 10; - } - - if (d >= 16) - break; - - value = (value << 4) + d; - } - - if (count <= 2) { - if (*p == '\0') - return value; - if (*p == '.') - return (FT_UInt32)(value | VARIANT_BIT); - } - } - - /* Look for a non-initial dot in the glyph name in order to */ - /* find variants like `A.swash', `e.final', etc. */ - { - const char* p = glyph_name; - const char* dot = NULL; - - for (; *p; p++) { - if (*p == '.' && p > glyph_name) { - dot = p; - break; - } - } - - /* now look up the glyph in the Adobe Glyph List */ - if (!dot) - return (FT_UInt32)ft_get_adobe_glyph_index(glyph_name, p); - else - return (FT_UInt32)(ft_get_adobe_glyph_index(glyph_name, dot) | - VARIANT_BIT); - } -} - -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]; - if (xyq_search_node(glyph_name, 0, child_offset, unicode)) - return; - } - - // failed, clear the buffer - glyph_name[0] = 0; -} diff --git a/core/src/fxge/freetype/fx_freetype.cpp b/core/src/fxge/freetype/fx_freetype.cpp new file mode 100644 index 0000000000..6cf5aa32ff --- /dev/null +++ b/core/src/fxge/freetype/fx_freetype.cpp @@ -0,0 +1,170 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "core/include/fxge/fx_freetype.h" + +#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) { + int i, count; + + // copy letters + while (1) { + glyph_name[name_offset] = ft_adobe_glyph_list[table_offset] & 0x7f; + name_offset++; + table_offset++; + if (!(ft_adobe_glyph_list[table_offset - 1] & 0x80)) + break; + } + glyph_name[name_offset] = 0; + + // get child count + count = ft_adobe_glyph_list[table_offset] & 0x7f; + + // 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! + return 1; + table_offset += 3; + } 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]; + if (xyq_search_node(glyph_name, name_offset, child_offset, unicode)) + // found in child + return 1; + } + return 0; +} + +#define VARIANT_BIT 0x80000000UL + +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') { + /* determine whether the next four characters following are */ + /* hexadecimal. */ + + /* XXX: Add code to deal with ligatures, i.e. glyph names like */ + /* `uniXXXXYYYYZZZZ'... */ + + FT_Int count; + FT_UInt32 value = 0; + const char* p = glyph_name + 3; + + for (count = 4; count > 0; count--, p++) { + char c = *p; + unsigned int d; + + d = (unsigned char)c - '0'; + if (d >= 10) { + d = (unsigned char)c - 'A'; + if (d >= 6) + d = 16; + else + d += 10; + } + + /* Exit if a non-uppercase hexadecimal character was found */ + /* -- this also catches character codes below `0' since such */ + /* negative numbers cast to `unsigned int' are far too big. */ + if (d >= 16) + break; + + value = (value << 4) + d; + } + + /* there must be exactly four hex digits */ + if (count == 0) { + if (*p == '\0') + return value; + if (*p == '.') + return (FT_UInt32)(value | VARIANT_BIT); + } + } + + /* 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') { + FT_Int count; + FT_UInt32 value = 0; + const char* p = glyph_name + 1; + + for (count = 6; count > 0; count--, p++) { + char c = *p; + unsigned int d; + + d = (unsigned char)c - '0'; + if (d >= 10) { + d = (unsigned char)c - 'A'; + if (d >= 6) + d = 16; + else + d += 10; + } + + if (d >= 16) + break; + + value = (value << 4) + d; + } + + if (count <= 2) { + if (*p == '\0') + return value; + if (*p == '.') + return (FT_UInt32)(value | VARIANT_BIT); + } + } + + /* Look for a non-initial dot in the glyph name in order to */ + /* find variants like `A.swash', `e.final', etc. */ + { + const char* p = glyph_name; + const char* dot = NULL; + + for (; *p; p++) { + if (*p == '.' && p > glyph_name) { + dot = p; + break; + } + } + + /* now look up the glyph in the Adobe Glyph List */ + if (!dot) + return (FT_UInt32)ft_get_adobe_glyph_index(glyph_name, p); + else + return (FT_UInt32)(ft_get_adobe_glyph_index(glyph_name, dot) | + VARIANT_BIT); + } +} + +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]; + if (xyq_search_node(glyph_name, 0, child_offset, unicode)) + return; + } + + // failed, clear the buffer + glyph_name[0] = 0; +} |