diff options
-rw-r--r-- | AUTHORS | 66 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 18 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp | 94 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 2 | ||||
-rw-r--r-- | core/src/fxcodec/codec/fx_codec_jpx_opj.cpp | 102 | ||||
-rw-r--r-- | core/src/fxge/freetype/fx_freetype.c | 338 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/global.cpp | 36 | ||||
-rw-r--r-- | third_party/freetype/src/psaux/psaux.c | 68 | ||||
-rw-r--r-- | third_party/macros.h | 62 |
9 files changed, 393 insertions, 393 deletions
@@ -1,33 +1,33 @@ -# Names should be added to this file with this pattern:
-#
-# For individuals:
-# Name <email address>
-#
-# For organizations:
-# Organization <fnmatch pattern>
-#
-# See python fnmatch module documentation for more information.
-
-Andrey Khalyavin <halyavin@chromium.org>
-Brett Wilson <brettw@chromium.org>
-Bruce Dawson <brucedawson@chromium.org>
-Chris Palmer <palmer@chromium.org>
-Finnur Thorarinsson <finnur@chromium.org>
-Jochen Eisinger <jochen@chromium.org>
-John Abd-El-Malek <jam@chromium.org>
-Julien Tinnes <jln@chromium.org>
-Kostya Serebryany <kcc@chromium.org>
-Lei Zhang <thestig@chromium.org>
-Lucas Nihlen <luken@chromium.org>
-Matt Giuca <mgiuca@chromium.org>
-Michael Doppler <m.doppler@gmail.com>
-Nico Weber <thakis@chromium.org>
-Peter Kasting <pkasting@chromium.org>
-Raymes Khoury <raymes@chromium.org>
-Reid Kleckner <rnk@chromium.org>
-Robert Sesek <rsesek@chromium.org>
-Thomas Sepez <tsepez@chromium.org>
-Jiang Jiang <jiangj@opera.com>
-
-Foxit Software Inc <*@foxitsoftware.com>
-Google Inc. <*@google.com>
+# Names should be added to this file with this pattern: +# +# For individuals: +# Name <email address> +# +# For organizations: +# Organization <fnmatch pattern> +# +# See python fnmatch module documentation for more information. + +Andrey Khalyavin <halyavin@chromium.org> +Brett Wilson <brettw@chromium.org> +Bruce Dawson <brucedawson@chromium.org> +Chris Palmer <palmer@chromium.org> +Finnur Thorarinsson <finnur@chromium.org> +Jochen Eisinger <jochen@chromium.org> +John Abd-El-Malek <jam@chromium.org> +Julien Tinnes <jln@chromium.org> +Kostya Serebryany <kcc@chromium.org> +Lei Zhang <thestig@chromium.org> +Lucas Nihlen <luken@chromium.org> +Matt Giuca <mgiuca@chromium.org> +Michael Doppler <m.doppler@gmail.com> +Nico Weber <thakis@chromium.org> +Peter Kasting <pkasting@chromium.org> +Raymes Khoury <raymes@chromium.org> +Reid Kleckner <rnk@chromium.org> +Robert Sesek <rsesek@chromium.org> +Thomas Sepez <tsepez@chromium.org> +Jiang Jiang <jiangj@opera.com> + +Foxit Software Inc <*@foxitsoftware.com> +Google Inc. <*@google.com> diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 670465673b..86db177ad7 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -519,8 +519,8 @@ void CPDF_LabCS::TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBuf, int } } CPDF_IccProfile::CPDF_IccProfile(FX_LPCBYTE pData, FX_DWORD dwSize): - m_bsRGB(FALSE),
- m_pTransform(NULL),
+ m_bsRGB(FALSE), + m_pTransform(NULL), m_nSrcComponents(0) { if (dwSize == 3144 && FXSYS_memcmp32(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0) { @@ -1376,13 +1376,13 @@ void CPDF_Color::SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comps, int ncomps) if (ncomps) { FXSYS_memcpy32(pvalue->m_Comps, comps, ncomps * sizeof(FX_FLOAT)); } - pvalue->m_pCountedPattern = NULL;
- if (pPattern && pPattern->m_pDocument)
- {
- if (!pDocPageData) {
- pDocPageData = pPattern->m_pDocument->GetPageData();
- }
- pvalue->m_pCountedPattern = pDocPageData->FindPatternPtr(pPattern->m_pPatternObj);
+ pvalue->m_pCountedPattern = NULL; + if (pPattern && pPattern->m_pDocument) + { + if (!pDocPageData) { + pDocPageData = pPattern->m_pDocument->GetPageData(); + } + pvalue->m_pCountedPattern = pDocPageData->FindPatternPtr(pPattern->m_pPatternObj); } } void CPDF_Color::Copy(const CPDF_Color* pSrc) diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp index fe5665d1fb..5df664312c 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -147,32 +147,32 @@ CPDF_DocPageData::~CPDF_DocPageData() { Clear(FALSE); Clear(TRUE); - FX_POSITION pos = m_PatternMap.GetStartPosition();
- while (pos)
- {
- CPDF_Object* ptObj;
- CPDF_CountedObject<CPDF_Pattern*>* ptData;
- m_PatternMap.GetNextAssoc(pos, ptObj, ptData);
- delete ptData;
- }
- m_PatternMap.RemoveAll();
- pos = m_FontMap.GetStartPosition();
- while (pos)
- {
- CPDF_Dictionary* fontDict;
- CPDF_CountedObject<CPDF_Font*>* fontData;
- m_FontMap.GetNextAssoc(pos, fontDict, fontData);
- delete fontData;
- }
- m_FontMap.RemoveAll();
- pos = m_ColorSpaceMap.GetStartPosition();
- while (pos)
- {
- CPDF_Object* csKey;
- CPDF_CountedObject<CPDF_ColorSpace*>* csData;
- m_ColorSpaceMap.GetNextAssoc(pos, csKey, csData);
- delete csData;
- }
+ FX_POSITION pos = m_PatternMap.GetStartPosition(); + while (pos) + { + CPDF_Object* ptObj; + CPDF_CountedObject<CPDF_Pattern*>* ptData; + m_PatternMap.GetNextAssoc(pos, ptObj, ptData); + delete ptData; + } + m_PatternMap.RemoveAll(); + pos = m_FontMap.GetStartPosition(); + while (pos) + { + CPDF_Dictionary* fontDict; + CPDF_CountedObject<CPDF_Font*>* fontData; + m_FontMap.GetNextAssoc(pos, fontDict, fontData); + delete fontData; + } + m_FontMap.RemoveAll(); + pos = m_ColorSpaceMap.GetStartPosition(); + while (pos) + { + CPDF_Object* csKey; + CPDF_CountedObject<CPDF_ColorSpace*>* csData; + m_ColorSpaceMap.GetNextAssoc(pos, csKey, csData); + delete csData; + } m_ColorSpaceMap.RemoveAll(); } void CPDF_DocPageData::Clear(FX_BOOL bForceRelease) @@ -673,24 +673,24 @@ void CPDF_DocPageData::ReleaseFontFileStreamAcc(CPDF_Stream* pFontStream, FX_BOO return; } PDF_DocPageData_Release<CPDF_Stream*, CPDF_StreamAcc*>(m_FontFileMap, pFontStream, NULL, bForce); -}
-CPDF_CountedColorSpace* CPDF_DocPageData::FindColorSpacePtr(CPDF_Object* pCSObj) const
-{
- if (!pCSObj) return NULL;
- CPDF_CountedObject<CPDF_ColorSpace*>* csData;
- if (m_ColorSpaceMap.Lookup(pCSObj, csData))
- {
- return csData;
- }
- return NULL;
-} -CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr(CPDF_Object* pPatternObj) const
-{
- if (!pPatternObj) return NULL;
- CPDF_CountedObject<CPDF_Pattern*>* ptData;
- if (m_PatternMap.Lookup(pPatternObj, ptData))
- {
- return ptData;
- }
- return NULL;
-}
+} +CPDF_CountedColorSpace* CPDF_DocPageData::FindColorSpacePtr(CPDF_Object* pCSObj) const +{ + if (!pCSObj) return NULL; + CPDF_CountedObject<CPDF_ColorSpace*>* csData; + if (m_ColorSpaceMap.Lookup(pCSObj, csData)) + { + return csData; + } + return NULL; +} +CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr(CPDF_Object* pPatternObj) const +{ + if (!pPatternObj) return NULL; + CPDF_CountedObject<CPDF_Pattern*>* ptData; + if (m_PatternMap.Lookup(pPatternObj, ptData)) + { + return ptData; + } + return NULL; +} diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp index 4644302c5b..9e61ce2f0b 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp @@ -143,7 +143,7 @@ FX_BOOL CPDF_ShadingPattern::Load() } CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData(); m_pCS = pDocPageData->GetColorSpace(pCSObj, NULL); - if (m_pCS) {
+ if (m_pCS) { m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray()); } m_ShadingType = pShadingDict->GetInteger(FX_BSTRC("ShadingType")); diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index 8dcecf9061..c4a0f88201 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -168,17 +168,17 @@ static void sycc422_to_rgb(opj_image_t *img) d2 = b = FX_Alloc(int, (size_t)max); for(i = 0; i < maxh; ++i) { - for (j = 0; (OPJ_UINT32)j < (maxw & ~(OPJ_UINT32)1); j += 2)
- {
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
- ++y; ++r; ++g; ++b;
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
- ++y; ++r; ++g; ++b; ++cb; ++cr;
- }
- if (j < maxw)
- {
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
- ++y; ++r; ++g; ++b; ++cb; ++cr;
+ for (j = 0; (OPJ_UINT32)j < (maxw & ~(OPJ_UINT32)1); j += 2) + { + sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); + ++y; ++r; ++g; ++b; + sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); + ++y; ++r; ++g; ++b; ++cb; ++cr; + } + if (j < maxw) + { + sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); + ++y; ++r; ++g; ++b; ++cb; ++cr; } } FX_Free(img->comps[0].data); @@ -218,46 +218,46 @@ static void sycc420_to_rgb(opj_image_t *img) d0 = r = FX_Alloc(int, (size_t)max); d1 = g = FX_Alloc(int, (size_t)max); d2 = b = FX_Alloc(int, (size_t)max); - for (i = 0; (OPJ_UINT32)i < (maxh & ~(OPJ_UINT32)1); i += 2)
- {
- ny = y + maxw;
- nr = r + maxw;
- ng = g + maxw;
- nb = b + maxw;
- for (j = 0; (OPJ_UINT32)j < (maxw & ~(OPJ_UINT32)1); j += 2)
- {
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
- ++y; ++r; ++g; ++b;
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
- ++y; ++r; ++g; ++b;
- sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
- ++ny; ++nr; ++ng; ++nb;
- sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
- ++ny; ++nr; ++ng; ++nb; ++cb; ++cr;
- }
- if (j < maxw)
- {
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
- ++y; ++r; ++g; ++b;
- sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb);
- ++ny; ++nr; ++ng; ++nb; ++cb; ++cr;
- }
- y += maxw; r += maxw; g += maxw; b += maxw;
- }
- if (i < maxh)
- {
- for (j = 0; (OPJ_UINT32)j < (maxw & ~(OPJ_UINT32)1); j += 2)
- {
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
- ++y; ++r; ++g; ++b;
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
- ++y; ++r; ++g; ++b; ++cb; ++cr;
- }
- if (j < maxw)
- {
- sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b);
- }
- }
+ for (i = 0; (OPJ_UINT32)i < (maxh & ~(OPJ_UINT32)1); i += 2) + { + ny = y + maxw; + nr = r + maxw; + ng = g + maxw; + nb = b + maxw; + for (j = 0; (OPJ_UINT32)j < (maxw & ~(OPJ_UINT32)1); j += 2) + { + sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); + ++y; ++r; ++g; ++b; + sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); + ++y; ++r; ++g; ++b; + sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb); + ++ny; ++nr; ++ng; ++nb; + sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb); + ++ny; ++nr; ++ng; ++nb; ++cb; ++cr; + } + if (j < maxw) + { + sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); + ++y; ++r; ++g; ++b; + sycc_to_rgb(offset, upb, *ny, *cb, *cr, nr, ng, nb); + ++ny; ++nr; ++ng; ++nb; ++cb; ++cr; + } + y += maxw; r += maxw; g += maxw; b += maxw; + } + if (i < maxh) + { + for (j = 0; (OPJ_UINT32)j < (maxw & ~(OPJ_UINT32)1); j += 2) + { + sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); + ++y; ++r; ++g; ++b; + sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); + ++y; ++r; ++g; ++b; ++cb; ++cr; + } + if (j < maxw) + { + sycc_to_rgb(offset, upb, *y, *cb, *cr, r, g, b); + } + } FX_Free(img->comps[0].data); img->comps[0].data = d0; diff --git a/core/src/fxge/freetype/fx_freetype.c b/core/src/fxge/freetype/fx_freetype.c index fe144d69a6..78dec9ad99 100644 --- a/core/src/fxge/freetype/fx_freetype.c +++ b/core/src/fxge/freetype/fx_freetype.c @@ -7,176 +7,176 @@ #include "../../../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;
+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;
-}
+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/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp index 88b3fe77ce..b45fd04558 100644 --- a/fpdfsdk/src/javascript/global.cpp +++ b/fpdfsdk/src/javascript/global.cpp @@ -18,24 +18,24 @@ // Helper class for compile-time calculation of hash values in order to // avoid having global object initializers. -template <unsigned ACC, wchar_t... Ns>
-struct CHash;
-
-// Only needed to hash single-character strings.
-template <wchar_t N>
-struct CHash<N> {
- static const unsigned value = N;
-};
-
-template <unsigned ACC, wchar_t N>
-struct CHash<ACC, N> {
- static const unsigned value = (ACC * 1313LLU + N) & 0xFFFFFFFF;
-};
-
-template <unsigned ACC, wchar_t N, wchar_t... Ns>
-struct CHash<ACC, N, Ns...> {
- static const unsigned value = CHash<CHash<ACC, N>::value, Ns...>::value;
-};
+template <unsigned ACC, wchar_t... Ns> +struct CHash; + +// Only needed to hash single-character strings. +template <wchar_t N> +struct CHash<N> { + static const unsigned value = N; +}; + +template <unsigned ACC, wchar_t N> +struct CHash<ACC, N> { + static const unsigned value = (ACC * 1313LLU + N) & 0xFFFFFFFF; +}; + +template <unsigned ACC, wchar_t N, wchar_t... Ns> +struct CHash<ACC, N, Ns...> { + static const unsigned value = CHash<CHash<ACC, N>::value, Ns...>::value; +}; extern const unsigned int JSCONST_nStringHash = CHash<'s','t','r','i','n','g'>::value; diff --git a/third_party/freetype/src/psaux/psaux.c b/third_party/freetype/src/psaux/psaux.c index ec9ba7aebb..a4b9c5c6e4 100644 --- a/third_party/freetype/src/psaux/psaux.c +++ b/third_party/freetype/src/psaux/psaux.c @@ -1,34 +1,34 @@ -/***************************************************************************/
-/* */
-/* psaux.c */
-/* */
-/* FreeType auxiliary PostScript driver component (body only). */
-/* */
-/* Copyright 1996-2001, 2002, 2006 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "psobjs.c"
-#include "psauxmod.c"
-#include "t1decode.c"
-#include "t1cmap.c"
-
-#ifndef T1_CONFIG_OPTION_NO_AFM
-#include "afmparse.c"
-#endif
-
-#include "psconv.c"
-
-
-/* END */
+/***************************************************************************/ +/* */ +/* psaux.c */ +/* */ +/* FreeType auxiliary PostScript driver component (body only). */ +/* */ +/* Copyright 1996-2001, 2002, 2006 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#define FT_MAKE_OPTION_SINGLE_OBJECT + +#include <ft2build.h> +#include "psobjs.c" +#include "psauxmod.c" +#include "t1decode.c" +#include "t1cmap.c" + +#ifndef T1_CONFIG_OPTION_NO_AFM +#include "afmparse.c" +#endif + +#include "psconv.c" + + +/* END */ diff --git a/third_party/macros.h b/third_party/macros.h index 92d4f34bda..b1b8c10888 100644 --- a/third_party/macros.h +++ b/third_party/macros.h @@ -1,31 +1,31 @@ -// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This file contains macros and macro-like constructs (e.g., templates) that
-// are commonly used throughout Chromium source. (It may also contain things
-// that are closely related to things that are commonly used that belong in this
-// file.)
-
-#ifndef BASE_MACROS_H_
-#define BASE_MACROS_H_
-
-// The COMPILE_ASSERT macro can be used to verify that a compile time
-// expression is true. For example, you could use it to verify the
-// size of a static array:
-//
-// COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES,
-// content_type_names_incorrect_size);
-//
-// or to make sure a struct is smaller than a certain size:
-//
-// COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large);
-//
-// The second argument to the macro is the name of the variable. If
-// the expression is false, most compilers will issue a warning/error
-// containing the name of the variable.
-
-#undef COMPILE_ASSERT
-#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
-
-#endif // BASE_MACROS_H_
+// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file contains macros and macro-like constructs (e.g., templates) that +// are commonly used throughout Chromium source. (It may also contain things +// that are closely related to things that are commonly used that belong in this +// file.) + +#ifndef BASE_MACROS_H_ +#define BASE_MACROS_H_ + +// The COMPILE_ASSERT macro can be used to verify that a compile time +// expression is true. For example, you could use it to verify the +// size of a static array: +// +// COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES, +// content_type_names_incorrect_size); +// +// or to make sure a struct is smaller than a certain size: +// +// COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large); +// +// The second argument to the macro is the name of the variable. If +// the expression is false, most compilers will issue a warning/error +// containing the name of the variable. + +#undef COMPILE_ASSERT +#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg) + +#endif // BASE_MACROS_H_ |