/************************************************************************ * This file has been generated automatically from * * * * src/core/textrenderer/qgstextrenderer.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/ class QgsTextRenderer { %Docstring Handles rendering text using rich formatting options, including drop shadows, buffers and background shapes. .. versionadded:: 3.0 %End %TypeHeaderCode #include "qgstextrenderer.h" %End public: enum DrawMode { Rect, Point, Label, }; enum TextPart { Text, Buffer, Background, Shadow, }; enum HAlignment { AlignLeft, AlignCenter, AlignRight, }; static int sizeToPixel( double size, const QgsRenderContext &c, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale &mapUnitScale = QgsMapUnitScale() ); %Docstring Calculates pixel size (considering output size should be in pixel or map units, scale factors and optionally oversampling) :param size: size to convert :param c: rendercontext :param unit: size units :param mapUnitScale: a mapUnitScale clamper :return: font pixel size %End static void drawText( const QRectF &rect, double rotation, HAlignment alignment, const QStringList &textLines, QgsRenderContext &context, const QgsTextFormat &format, bool drawAsOutlines = true ); %Docstring Draws text within a rectangle using the specified settings. :param rect: destination rectangle for text :param rotation: text rotation :param alignment: horizontal alignment :param textLines: list of lines of text to draw :param context: render context :param format: text format :param drawAsOutlines: set to ``False`` to render text as text. This allows outputs to formats like SVG to maintain text as text objects, but at the cost of degraded rendering and may result in side effects like misaligned text buffers. This setting is deprecated and has no effect as of QGIS 3.4.3 and the text format should be set using :py:func:`QgsRenderContext.setTextRenderFormat()` instead. %End static void drawText( QPointF point, double rotation, HAlignment alignment, const QStringList &textLines, QgsRenderContext &context, const QgsTextFormat &format, bool drawAsOutlines = true ); %Docstring Draws text at a point origin using the specified settings. :param point: origin of text :param rotation: text rotation :param alignment: horizontal alignment :param textLines: list of lines of text to draw :param context: render context :param format: text format :param drawAsOutlines: set to ``False`` to render text as text. This allows outputs to formats like SVG to maintain text as text objects, but at the cost of degraded rendering and may result in side effects like misaligned text buffers. This setting is deprecated and has no effect as of QGIS 3.4.3 and the text format should be set using :py:func:`QgsRenderContext.setTextRenderFormat()` instead. %End static void drawPart( const QRectF &rect, double rotation, HAlignment alignment, const QStringList &textLines, QgsRenderContext &context, const QgsTextFormat &format, TextPart part, bool drawAsOutlines = true ) /Deprecated/; %Docstring Draws a single component of rendered text using the specified settings. :param rect: destination rectangle for text :param rotation: text rotation :param alignment: horizontal alignment :param textLines: list of lines of text to draw :param context: render context :param format: text format :param part: component of text to draw. Note that Shadow parts cannot be drawn individually and instead are drawn with their associated part (e.g., drawn together with the text or background parts) :param drawAsOutlines: set to ``False`` to render text as text. This allows outputs to formats like SVG to maintain text as text objects, but at the cost of degraded rendering and may result in side effects like misaligned text buffers. This setting is deprecated and has no effect as of QGIS 3.4.3 and the text format should be set using :py:func:`QgsRenderContext.setTextRenderFormat()` instead. .. deprecated:: Private API only, will be removed in 4.0 %End static void drawPart( QPointF origin, double rotation, HAlignment alignment, const QStringList &textLines, QgsRenderContext &context, const QgsTextFormat &format, TextPart part, bool drawAsOutlines = true ) /Deprecated/; %Docstring Draws a single component of rendered text using the specified settings. :param origin: origin for start of text. Y coordinate will be used as baseline. :param rotation: text rotation :param alignment: horizontal alignment :param textLines: list of lines of text to draw :param context: render context :param format: text format :param part: component of text to draw. Note that Shadow parts cannot be drawn individually and instead are drawn with their associated part (e.g., drawn together with the text or background parts) :param drawAsOutlines: set to ``False`` to render text as text. This allows outputs to formats like SVG to maintain text as text objects, but at the cost of degraded rendering and may result in side effects like misaligned text buffers. This setting is deprecated and has no effect as of QGIS 3.4.3 and the text format should be set using :py:func:`QgsRenderContext.setTextRenderFormat()` instead. .. deprecated:: Private API only, will be removed in 4.0 %End static QFontMetricsF fontMetrics( QgsRenderContext &context, const QgsTextFormat &format ); %Docstring Returns the font metrics for the given text ``format``, when rendered in the specified render ``context``. The font metrics will take into account all scaling required by the render context. .. versionadded:: 3.2 %End static double textWidth( const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, QFontMetricsF *fontMetrics = 0 ); %Docstring Returns the width of a text based on a given format. :param context: render context :param format: text format :param textLines: list of lines of text to calculate width from :param fontMetrics: font metrics %End static double textHeight( const QgsRenderContext &context, const QgsTextFormat &format, const QStringList &textLines, DrawMode mode = Point, QFontMetricsF *fontMetrics = 0 ); %Docstring Returns the height of a text based on a given format. :param context: render context :param format: text format :param textLines: list of lines of text to calculate width from :param mode: draw mode :param fontMetrics: font metrics %End }; /************************************************************************ * This file has been generated automatically from * * * * src/core/textrenderer/qgstextrenderer.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/