for (int i = 0; i < wx.length; i++) {
Element wxel = doc.createElement("wx");
wxel.setAttribute("w", String.valueOf(wx[i]));
+ int[] bbox = ttf.getBBox(i);
+ wxel.setAttribute("xMin", String.valueOf(bbox[0]));
+ wxel.setAttribute("yMin", String.valueOf(bbox[1]));
+ wxel.setAttribute("xMax", String.valueOf(bbox[2]));
+ wxel.setAttribute("yMax", String.valueOf(bbox[3]));
el.appendChild(wxel);
}
}
return wx;
}
+ /**
+ * Returns an array (xMin, yMin, xMax, yMax) for a glyph.
+ *
+ * @param glyphIndex the index of the glyph
+ * @return int[] Array defining bounding box.
+ */
+ public int[] getBBox(int glyphIndex) {
+ int[] bboxInTTFUnits = mtxTab[glyphIndex].getBoundingBox();
+ int[] bbox = new int[4];
+ for (int i = 0; i < 4; i++) {
+ bbox[i] = (int) convertTTFUnit2PDFUnit(bboxInTTFUnits[i]);
+ }
+ return bbox;
+ }
+
/**
* Returns the width of a given character.
* @param idx Index of the character
documents. Example: the fix of marks layering will be such a case when it's done.
-->
<release version="FOP Trunk" date="TBD">
+ <action context="Fonts" dev="PH" type="add" fixes-bug="FOP-1069" due-to="Alexey Neyman">
+ TTFReader: Output bounding box information for glyphs.
+ </action>
<action context="Code" dev="PH" type="fix" fixes-bug="FOP-1069" due-to="Robert Meyer">
Warn instead or error on invalid property values.
</action>