Code

No more NRMatrix or NRPoint.
[inkscape.git] / src / libnrtype / Layout-TNG.h
index 5c86d3135ac6cd06a4e6d548d8743cb5d8a5b663..ec12ddff59e12051b8340082428cb7329b9895e3 100755 (executable)
 #include "libnr/nr-rotate-ops.h"
 #include <glibmm/ustring.h>
 #include <pango/pango-break.h>
+#include <algorithm>
 #include <vector>
 
+#ifdef HAVE_CAIRO_PDF
+namespace Inkscape {
+        namespace Extension {
+                namespace Internal {
+                        class CairoRenderContext;
+                }
+        }
+}
+
+using Inkscape::Extension::Internal::CairoRenderContext;
+#endif
+
 class SPStyle;
 class Shape;
 class NRArenaGroup;
@@ -27,6 +40,7 @@ class SVGLength;
 class Path;
 class SPCurve;
 class font_instance;
+typedef struct _PangoFontDescription PangoFontDescription;
 
 namespace Inkscape {
 namespace Text {
@@ -323,7 +337,14 @@ public:
      \param bbox  parameters
      \param ctm   do yet
     */
-    void print(SPPrintContext *ctx, NRRect const *pbox, NRRect const *dbox, NRRect const *bbox, NRMatrix const &ctm) const;
+    void print(SPPrintContext *ctx, NRRect const *pbox, NRRect const *dbox, NRRect const *bbox, NR::Matrix const &ctm) const;
+
+#ifdef HAVE_CAIRO_PDF    
+    /** Renders all the glyphs to the given Cairo rendering context.
+     \param ctx   The Cairo rendering context to be used
+     */
+    void showGlyphs(CairoRenderContext *ctx) const;
+#endif
 
     /** debug and unit test method. Creates a textual representation of the
     contents of this object. The output is designed to be both human-readable
@@ -423,7 +444,7 @@ public:
     /** Returns the bounding box of the given glyph, and its rotation.
     The centre of rotation is the horizontal centre of the box at the
     text baseline. */
-    NR::Rect glyphBoundingBox(iterator const &it, double *rotation) const;
+    NR::Maybe<NR::Rect> glyphBoundingBox(iterator const &it, double *rotation) const;
 
     /** Returns the zero-based line number of the character pointed to by
     \a it. */
@@ -579,6 +600,8 @@ private:
         
         // a few functions for some of the more complicated style accesses
         float styleComputeFontSize() const;
+        /// The return value must be freed with pango_font_description_free()
+        PangoFontDescription *styleGetFontDescription() const;
         font_instance *styleGetFontInstance() const;
         Direction styleGetBlockProgression() const;
         Alignment styleGetAlignment(Direction para_direction, bool try_text_align) const;
@@ -710,7 +733,7 @@ private:
 
     /** gets the overall matrix that transforms the given glyph from local
     space to world space. */
-    void _getGlyphTransformMatrix(int glyph_index, NRMatrix *matrix) const;
+    void _getGlyphTransformMatrix(int glyph_index, NR::Matrix *matrix) const;
 
     // loads of functions to drill down the object tree, all of them
     // annoyingly similar and all of them requiring predicate functors.