Re: Cairo PDFs - vector or raster?
Adrian Johnson <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
On 22/04/15 06:23, C. Thomas Stover wrote: > While looking deeper into the disconcerting world of printing and PDF > files, I realized the model is a great deal more complex than I first > imagined. Text in particular can be realized as either A) postscript that > drives the PDF renderer's or printer rasterizer's font engine B) > postscript defining vector graphics that form the shapes of glyphs > (perhaps translated from scalable font formats) C) raster image / > bitmaps. The problem with A is the lack of anything resembling Unicode > support. > > Seeing as how pango + cairo can produce PDF and PS files with Unicode > text, how is the text in those files encoded? As pixels, paths, or > characters + font controls? > > (yes I know I could look, but I'm hoping to learn something I haven't > figured out yet by the responses) > Cairo PDF and PS output uses embedded fonts for drawing text. The embedded fonts are subsetted to remove unused glyphs while being careful to preserve font hinting. The encoding used depends on the output format and the characters used. For PDF, glyphs that map to characters in the PDF WinAnsiEncoding are placed in an 8-bit font with that encoding. Other glyphs are placed in a 16-bit font with a custom encoding (the glyphs ids are assigned sequentially starting from 1). A ToUnicode map and optionally ActualText is embedded to allow extracting the unicode characters for the glyphs. Cairo user fonts are embedded using Type 3 fonts. Most of the font subsetting code is shared by PS and PDF. The PS embedded fonts are the same as PDF with a couple of exceptions: - PS does not have a builting WinAnsiEncoding. Instead we create a custom 8-bit font with the same encoding. - While it is possible to create PS composite fonts with a 16-bit encoding, we use only 8-bits fonts. Multiple 8-bit fonts are used to contain all glyphs that don't map the WinAnsi encoding. -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo