Class PDFGlyphWidthTable
The pdf format for widths looks like: [cid [w1 w2 w3] cidfirst cidlast w4 cid2 [w5 w6 w7 w8]]
so the widths for a range of cids can be specified as an array of widths, or by a single width that applies to every cid in the range.
All WidthTableEntries have a startcid & endcid range and can then hold either a) an array of endcid-startcid+1 floats b) a single float
The widthtable can then do a binary search through the table to find the specific widthtable entry. The worst possible case would be a table of 64k entries, each describing a single glyph, and a search for a glyph through this would take log2(65536) = 16 hops through a huge table. Any fontlist this large would actually just revert to a single entry with 64k widths, so there would be no searching. Average case would be a much smaller, especially since this is often used for font subsets.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat
getWidth
(int cid) Binary search the list and return the width
-
Constructor Details
-
PDFGlyphWidthTable
Main constructor. pdfwidths is the array from the CIDfont's /W entry, and defwidth is the /DW entry. Both entries are optional, in which case all the widths are 1000.
-
-
Method Details
-
getWidth
public float getWidth(int cid) Binary search the list and return the width
-