Re: [Podofo-users] String width is incorrect when using font loaded from pdf
A PDF parsing, modification and creation library.
Brought to you by:
domseichter
|
From: Michal S. <sud...@gm...> - 2018-12-05 19:34:56
|
Patch with corrected indentation attached. On Wed, Dec 5, 2018 at 8:31 PM Michal Sudolsky <sud...@gm...> wrote: > Proposed patch attached. > > It follows something similar what is doing ConvertToEncoding in its core. > Now widths of all font supported unicode chars are correctly obtained. I > also deduplicated PdfFontMetricsObject::CharWidth as it does same thing as > UnicodeCharWidth and left GetGlyphWidth unimplemented as this would require > converting glyph to cid for cid encoding. > > > On Wed, Nov 28, 2018 at 11:39 PM Michal Sudolsky <sud...@gm...> > wrote: > >> PdfFontMetricsObject::UnicodeCharWidth returns width for CID instead of >> unicode char (like does PdfFontMetricsFreetype and PdfFontMetricsBase14). >> Maybe it can be fixed by converting unicode char into CID using >> m_pEncoding->GetCIDValue (after few modifications). And implement also >> PdfFontMetricsObject::GetGlyphId. Body of UnicodeCharWidth could be >> implementation of PdfFontMetricsObject::GetGlyphWidth. Actually W contains >> CIDs and not glyphs so GetCIDValue may work for UnicodeCharWidth but I am >> not sure about GetGlyphId and GetGlyphWidth if encoding or CIDToGIDMap is >> not identity. >> >> |