[PATCH] Add CairoOutputDev functions for getting Type 3 glyph metrics

Adrian Johnson ajohnson at redneon.com
Fri Oct 31 07:51:39 PDT 2008


---
 poppler/CairoOutputDev.cc |   10 ++++++++++
 poppler/CairoOutputDev.h  |    7 +++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index eec5167..3a9d452 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -126,6 +126,7 @@ CairoOutputDev::CairoOutputDev() {
   currentFont = NULL;
   prescaleImages = gTrue;
   printing = gTrue;
+  t3_glyph_has_bbox = gFalse;
 
   groupColorSpaceStack = NULL;
   group = NULL;
@@ -675,10 +676,19 @@ void CairoOutputDev::endType3Char(GfxState *state) {
 }
 
 void CairoOutputDev::type3D0(GfxState *state, double wx, double wy) {
+  t3_glyph_wx = wx;
+  t3_glyph_wy = wy;
 }
 
 void CairoOutputDev::type3D1(GfxState *state, double wx, double wy,
 			     double llx, double lly, double urx, double ury) {
+  t3_glyph_wx = wx;
+  t3_glyph_wy = wy;
+  t3_glyph_bbox[0] = llx;
+  t3_glyph_bbox[1] = lly;
+  t3_glyph_bbox[2] = urx;
+  t3_glyph_bbox[3] = ury;
+  t3_glyph_has_bbox = gTrue;
 }
 
 void CairoOutputDev::endTextObject(GfxState *state) {
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index d70740d..b57f734 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -214,6 +214,10 @@ public:
   void setCairo (cairo_t *cr);
   void setPrinting (GBool printing) { this->printing = printing; }
 
+  void getType3GlyphWidth (double *wx, double *wy) { *wx = t3_glyph_wx; *wy = t3_glyph_wy; }
+  GBool hasType3GlyphBBox () { return t3_glyph_has_bbox; }
+  double *getType3GlyphBBox () { return t3_glyph_bbox; }
+
 protected:
   void doPath(cairo_t *cairo, GfxState *state, GfxPath *path);
   
@@ -240,6 +244,9 @@ protected:
   cairo_glyph_t *glyphs;
   int glyphCount;
   cairo_path_t *textClipPath;
+  double t3_glyph_wx, t3_glyph_wy;
+  GBool t3_glyph_has_bbox;
+  double t3_glyph_bbox[4];
 
   GBool prescaleImages;
 
-- 
1.5.6.3


--------------090504070501070603020308
Content-Type: text/x-patch;
 name="0006-Implement-Type-3-fonts-in-cairo-backend-using-cairo.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename*0="0006-Implement-Type-3-fonts-in-cairo-backend-using-cairo.pat";
 filename*1="ch"



More information about the poppler mailing list