>> encoding = PoDoFo::PdfEncodingFactory::GlobalWinAnsiEncodingInstance();

>>pdfFont = pdf->CreateFontSubset(fontName, isBold, isItalic, false,
encoding, fontPath);


>>Do you think you could look into this?

Hi,

PdfIdentityEncoding is currently only way to get it out of the box.



To use other encoding, then all text drawn with that font MUST be defined
within chosen encoding. When I catch a time, I will see what to do.


The problem is what to do when you attempt to draw a character out of
defined encoding? To emit a .notdef glyph or try something else? To throw
exception if character is out of the range of selected PdfEncoding?


What do you mean, which strategy to take?



If you take a PDF created with cairo pdf engine, and look to the magic
behind, then you will see that they split a text drawn into series of
separate rounds. They use two fonts to achieve that. First font is used
whenever character fals into encoding range (ae: GlobalWinAnsiEncoding). It
char is out of that range, then they select another font, based on the same
font, but with differenent encoding (Identity-H).



Two fonts or subsets are embedded into pdf. First contains used
characters/glyphs they belong to selected encoding. Second font uses
Idenity-H encoding and contains only glyphs they do not belong to the first
font encoding. This second font program contains only a few glyphs which
are totally remaped. See a cmap table for second font (44 0 obj).



Here is a sample how to draw a text "račun".



BT

...

/f-2-0 1 Tf

[(ra)]TJ

/f-2-1 1 Tf

<0001>Tj

/f-2-0 1 Tf

[(un)]TJ

...

ET



/Font <<

...

/f-2-0 9 0 R

/f-2-1 10 0 R

>>



9 0 obj

<<

/Type /Font

/BaseFont /WPTTXN+ArialMT

/Encoding /WinAnsiEncoding

/FirstChar 32

/FontDescriptor 41 0 R

/LastChar 158

/Subtype /TrueType

/ToUnicode 39 0 R

/Widths [ ... ]

>>

endobj



10 0 obj

<<

/Type /Font

/BaseFont /LNFXMJ+ArialMT

/DescendantFonts [ 47 0 R ]

/Encoding /Identity-H

/Subtype /Type0

/ToUnicode 44 0 R

>>

endobj





44 0 obj << /Length ...>>

stream

/CIDInit /ProcSet findresource begin

12 dict begin

begincmap

/CIDSystemInfo

<< /Registry (Adobe)

   /Ordering (UCS)

   /Supplement 0

>> def

/CMapName /Adobe-Identity-UCS def

/CMapType 2 def

1 begincodespacerange

<0000> <ffff>

endcodespacerange

4 beginbfchar

<0001> <010d>

<0002> <0106>

<0003> <0107>

<0004> <0111>

endbfchar

endcmap

CMapName currentdict /CMap defineresource pop

end

endstream

endobj
------------------------------------------------------------------------------
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to