summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_font
AgeCommit message (Collapse)Author
2016-09-15Rename dictionary set and get methodsdsinclair
This Cl makes the Get and Set methods consistenly use {G|S}et<Type>For. BUG=pdfium:596 Review-Url: https://codereview.chromium.org/2334323005
2016-09-13Remove more strcmp/memcmp usage.tsepez
Review-Url: https://codereview.chromium.org/2340513002
2016-09-01Fix CPDF_CIDFont::GlyphFromCharCode for fonts flagged with PDFFONT_SYMBOLICnpm
UnicodeFromCharCode should be tried even if the font is flagged as PDFFONT_SYMBOLIC. The result should be checked in case it's empty. This fixes some corpus tests that were being incorrectly rendered, as well as the bug below. A deps change will be required before landing this CL. BUG=chromium:591303 Review-Url: https://codereview.chromium.org/2300893003
2016-08-30Clean up CPDF_CMap declarationchromium/2845npm
- Removed unused methods - Friendship with CPDF_PathManager is not needed - Protected may be changed to private Review-Url: https://codereview.chromium.org/2292023003
2016-08-30Guard against overflow when calculating font weight.dsinclair
This CL uses the safe math libraries when calculating the font weight from the StemV value as very large values for StemV can cause the signed int to overflow. BUG=chromium:641418 Review-Url: https://codereview.chromium.org/2293633002
2016-08-24Allow CPDF_Font to use fallback fontsnpm
Added a vector of pointers to CFX_Fonts in the class CPDF_Font, so that fallback fonts may be used. In CPDF_CharPosList::Load, the glyphs for each character are calculated. When m_Font does not support a character, a fallback font is selected and the character is rendered using that font. This meant adding an attribute to FXTEXT_CHARPOS so it knows which font renders it. Also, methods in fpdf_render_text.cpp now may need to call device drawing methods multiple times because these only support one font at a time. In CPDF_TextRenderer::DrawNormalText and in CPDF_TextRenderer::DrawTextPath, the device drawing method is called as few times as possible by grouping contiguous characters rendered by the same font. In CPDF_RenderStatus::DrawTextPathWithPattern, drawing was already done one character at a time, but precalculating CFX_FaceCache. Now, the face cache is precalculated for all of the fallback fonts. The list of fallback fonts does not include tha main font. Otherwise the list would be of raw pointers to avoid double free problems. For now, the font Arial is used as fallback. This should fix the issue of not seeing Latin characters displayed when bad fonts are used. However, this should be improved. Tested manually using the file in the bug, plus a font directory containing a font that supports Hangul but not Latin. This font is chosen as the substitute font, but Latin characters are now being rendered. Design proposal: go/pdfium_fallbackfonts BUG=pdfium:358 Review-Url: https://codereview.chromium.org/2276653002
2016-08-19Avoid signed overflow in CPDF_ToUnicodeMap::StringToCode()tsepez
It was intended to be unsigned in the first place, and we're perfectly happy with the overflow as long as it is no longer undefined behaviour. BUG=638489 Review-Url: https://codereview.chromium.org/2258053003
2016-08-15Fix a potential integer overflow in TT2PDF().chromium/2830thestig
BUG=635438 Review-Url: https://codereview.chromium.org/2248473002
2016-08-15Get rid of FX_SMALL_RECT.thestig
Review-Url: https://codereview.chromium.org/2248463002
2016-08-15Use a std::vector in fpdf_font code.thestig
Review-Url: https://codereview.chromium.org/2248453002
2016-08-10Move CFX_RenderDevice, CFX_FxgeDevice, and CFX_GraphStateData into their own ↵npm
files. This is the third CL to separate fx_ge into classes, one per file. All fx_ge.h includes had to be replaced with new includes The method definitions for CFX_FxgeDevice were not moved to a single file. These methods are defined in two folders different from fxge/ge, so they were left untouched for now. Review-Url: https://codereview.chromium.org/2223213002
2016-08-09Fix typos of the word outer.thestig
Review-Url: https://codereview.chromium.org/2226003003
2016-08-05Add CPDF_ImageObject::GetImage().thestig
And use it where appropriate. Review-Url: https://codereview.chromium.org/2224623002
2016-08-04Move CFX_GEModule into its own filenpm
This is the first CL in an attempt to split up the classes in fxge/include/fx_ge.h into their own files. Review-Url: https://codereview.chromium.org/2217663002
2016-07-29Cleanup CPDF_DocPageData release methods and callers.thestig
Review-Url: https://codereview.chromium.org/2194853002
2016-07-25Use smart pointers for CFX_Font and CFX_Type3Font classesweili
For the class owned member variables, use std::unique_ptr or std::vector for memory management. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2169793002
2016-07-06Change class member variables in raw pointer type into unique_ptrweili
Also did some cleanups such as removing an unused member variables and some unused structs. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2119013002
2016-07-01Clean up parts of CPDF_CIDFont.thestig
Also remove some if statements that are always true/false. Review-Url: https://codereview.chromium.org/2094073002
2016-06-27Clean up some CPDF_Font subclasses.thestig
Review-Url: https://codereview.chromium.org/2093313002
2016-06-23Remove FPDFAPI_LoadCID2UnicodeMap.dsinclair
This Cl removes FPDFAPI_LoadCID2UnicodeMap() and inlines the code into the one caller. Review-Url: https://codereview.chromium.org/2097513002
2016-06-21Move ifx_renderdevicedriver to a separate file to shareweili
Move ifx_renderdevicedriver class to its own file to share with multiple devices to reduce code duplication. Review-Url: https://codereview.chromium.org/2078783002
2016-06-20Change func(void) to func()weili
Since PDFium is compiled as C++ code, the void keyword is not needed. BUG=pdfium:519 Review-Url: https://codereview.chromium.org/2084603003
2016-06-20Another round of fx_ge cleanup.thestig
- Clean up CFX_GEModule. - Remove duplicate #defines in fx_ge.h - Remove IsFontStyleFromCharCode() that always returns true. - Mark a FXTEXT_CHARPOS field as Mac only. Review-Url: https://codereview.chromium.org/2075333002
2016-06-13Make code compile with clang_use_chrome_plugin (part I)weili
This change contains files in core/fpdfapi directory. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups; BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2060973002
2016-06-08Remove even more const casting from core.tsepez
Make the return types/arguments match reality. Review-Url: https://codereview.chromium.org/2053483002
2016-06-07Avoid const-cast in CPDF_Fonttsepez
Introduce a logically const initialization (via mutable members) so that this can happen lazily under const methods. Review-Url: https://codereview.chromium.org/2045033002
2016-06-07Use static_casts for cpdf_type1font bsearch on mac.tsepez
Also sort the static table to be compatible with bsearch(). Review-Url: https://codereview.chromium.org/2047813002
2016-06-07Get rid of NULLs in core/thestig
Review-Url: https://codereview.chromium.org/2032613003
2016-06-02Fix all the code which has duplicate variable declarationsweili
When there are duplicate variable declarations, the inner names shadow the outter ones. This is error prone and harder to read. Remove all the instances found by /analyze. BUG=chromium:613623, chromium:427616 Review-Url: https://codereview.chromium.org/2027273002
2016-06-01Change CFX_Font::GetPsName() to return a CFX_ByteString.thestig
So everyone can avoid doing Byte to WideString conversions. Also remove CFX_GEFont::GetPsName() and deduplicate a couple of GetPsName() calls. Review-Url: https://codereview.chromium.org/2019173002
2016-05-23Use unique_ptr in CPDF_CidFonttsepez
Review-Url: https://codereview.chromium.org/2003833003
2016-05-12Add CFX_ByteStringC::CharAt() to avoid c_str() and casts.tsepez
Most of the time, we want to operate on chars as if they were unsigned, but there are a few places where we need the default (questionably signed) values. Consolidate the casting in a single place rather than forcing callers to get a char* ptr. BUG=pdfium:493 Review-Url: https://codereview.chromium.org/1972053003
2016-05-12Clean up CFX_ImageTransformer.thestig
Review-Url: https://codereview.chromium.org/1973913002
2016-05-11Remove c_str() from fpdf_font.cpptsepez
BUG=pdfium:493 Review-Url: https://codereview.chromium.org/1967223002
2016-04-26Remove several IPDF_ interfaces and CPDF_RenderModule.dsinclair
This CL removes the interfaces: * IPDF_ObjectRenderer * IPDF_OCContext * IPDF_RenderModule * IPDF_PageModule The CPDF_RenderModule was just wrapping new and delete calls. This Cl moves those up to the callers and removes the CPDF_RenderModule class. Review URL: https://codereview.chromium.org/1918323003
2016-04-26Clean up CPDF_Page.thestig
- Merge CPDF_Page::Load() into ctor. - Remove always nullptr param for CPDF_Page::ParseContent(). - Remove unneeded indirection in IPDF_RenderModule. - Delete CPDF_ParseOptions. - Fix up CPDF_Pattern. Review URL: https://codereview.chromium.org/1918113002
2016-04-22Remove #ifdef platform which is always true.tsepez
fx_system.h errors out during compile if _FXM_PLATFORM_ is not one of the four values tested in the ifdef. Remove duplicated code, and use unique_ptr for cleanup. Review URL: https://codereview.chromium.org/1912023002
2016-04-21Remove one warning from PDFium compilation in Crosweili
The original code caused an optimization warning when gcc tries to get rid of 'count > m_Length - index' in CFX_ByteStringC::Mid() while assuming there is no signed integer overflow. This could also be avoided once FX_STRSIZE is no longer a signed integer type. Review URL: https://codereview.chromium.org/1906213002
2016-04-14Explicity use CFX_ByteStrings in a couple of placestsepez
These are exposed by making the ByteString from ByteStringC ctor explicit, but we can clean them up independently. Review URL: https://codereview.chromium.org/1884363002
2016-04-14Avoid string allocs for CMap_GetString() return value.tsepez
StringC's are all that's needed here. Also CMap_GetString() and GetCode() are side-effect free, so remove calls where the value is not used. Review URL: https://codereview.chromium.org/1889003002
2016-04-13Remove implicit cast from CFX_ByteString to (const char*).tsepez
BUG= Review URL: https://codereview.chromium.org/1885973002
2016-04-12Cleanup various IFX_ text interfaces.dsinclair
This CL removes IFX_ArabicChar, IFX_RTFBreak, IFX_TxtBreak, IFX_WordBreak, IFX_FormatString, and IFX_GSUBTable. References were updated to be the concrete classes. The CFX_GSUBTable was also removed as it is unused. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1882213002
2016-04-11Use std::vector as internal storage for CPDF_ArrayWei Li
Replace the usage of CFX_ArrayTemplate inside CPDF_Array, which has non-standard APIs such as GetSize() returns int. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1867183002 .
2016-04-08Rename both As{Byte,Wide}StringC() helpers to AsStringC().tsepez
The naming is redundant given the base type, and will stand in the way of consolidating Byte and Wide code. BUG= Review URL: https://codereview.chromium.org/1862123003
2016-04-06Move core/include/fxge to core/fxge/include.dsinclair
This CL is a straight move of the fxge includes into core/fxge/include. Review URL: https://codereview.chromium.org/1868533002
2016-04-05Rename GetCStr and GetPtr to match CFX_ByteString.dsinclair
This CL updates CFX_ByteStringC to use the more common c_str and raw_str instead of GetCStr and GetPtr. Review URL: https://codereview.chromium.org/1857713003
2016-04-04Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC.tsepez
Having this happen implicitly can be dangerous because the lifetime has to be considered; we should have caught the "red bots" in https://codereview.chromium.org/1847333004/#ps60001 at compile time. Review URL: https://codereview.chromium.org/1853233002
2016-03-29Code change to avoid signed/unsigned mismatch warnings.Wei Li
This makes pdfium code on Linux and Mac sign-compare warning free. The warning flag will be re-enabled after checking on windows clang build. BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1841643002 .
2016-03-29Rename GetElementValue() to GetDirectObject{By,At}().tsepez
Every time I read this code, I have to make the mental substituion that "Element value" means "de-ref indirect object", so it might as well just say so. BUG= Review URL: https://codereview.chromium.org/1841173002
2016-03-28Cleanup one mac headerWei Li
Remove unimplemented/unused class, and other cleanup R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1834063002 .