当前位置: 首页>>代码示例>>C++>>正文


C++ TextStyle::rtl方法代码示例

本文整理汇总了C++中TextStyle::rtl方法的典型用法代码示例。如果您正苦于以下问题:C++ TextStyle::rtl方法的具体用法?C++ TextStyle::rtl怎么用?C++ TextStyle::rtl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextStyle的用法示例。


在下文中一共展示了TextStyle::rtl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawComplexText

void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const TextStyle& style, const FloatPoint& point, int from, int to) const
{
    cairo_t* cr = context->platformContext();
    cairo_save(cr);
    
    PangoLayout* layout = pango_cairo_create_layout(cr);
    
    gchar* utf8 = convertUniCharToUTF8(run.characters(), run.length(), from, run.length());
    pango_layout_set_text(layout, utf8, -1);
    
    setPangoAttributes(this, run, layout, style.rtl());
    
    // Set the text color to use for drawing.
    float red, green, blue, alpha;
    Color penColor = context->fillColor();
    penColor.getRGBA(red, green, blue, alpha);
    cairo_set_source_rgba(cr, red, green, blue, alpha);
    
    cairo_move_to(cr, point.x(), point.y());
    PangoLayoutLine* layoutLine = pango_layout_get_line(layout, 0);
    pango_cairo_show_layout_line(cr, layoutLine);
    g_free(utf8);

    g_object_unref(layout);
    cairo_restore(cr);
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:26,代码来源:FontGdkApollo.cpp

示例2: drawComplexText

void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const TextStyle& style, const FloatPoint& point,
                           int from, int to) const
{
    // This glyph buffer holds our glyphs + advances + font data for each glyph.
    GlyphBuffer glyphBuffer;

    float startX = point.x();
    UniscribeController controller(this, run, style);
    controller.advance(from);
    float beforeWidth = controller.runWidthSoFar();
    controller.advance(to, &glyphBuffer);
    
    // We couldn't generate any glyphs for the run.  Give up.
    if (glyphBuffer.isEmpty())
        return;
    
    float afterWidth = controller.runWidthSoFar();

    if (style.rtl()) {
        controller.advance(run.length());
        startX += controller.runWidthSoFar() - afterWidth;
    } else
        startX += beforeWidth;

    // Draw the glyph buffer now at the starting point returned in startX.
    FloatPoint startPoint(startX, point.y());
    drawGlyphBuffer(context, glyphBuffer, run, style, startPoint);
}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:28,代码来源:FontWin.cpp

示例3: selectionRectForComplexText

FloatRect Font::selectionRectForComplexText(const TextRun& run, const TextStyle& style, const IntPoint& point, int h, int from, int to) const
{
    FloatRect rect;
	float tw;

    PangoLayout* layout = getDefaultPangoLayout(run);
    setPangoAttributes(this, run, layout, style.rtl());

    float beforeWidth = getWidth (layout, run, 0, from);
    float afterWidth = getWidth (layout, run, 0, to);

    if (style.rtl()) {
        float totalWidth = getWidth (layout, run, 0, run.length());
tw = totalWidth;
        rect = FloatRect(point.x() + floorf(totalWidth - afterWidth), point.y(), roundf(totalWidth - beforeWidth) - floorf(totalWidth - afterWidth), h);
    } 
    else
        rect = FloatRect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h);

    g_object_unref(layout);

    return rect;
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:23,代码来源:FontGdkApollo.cpp

示例4: offsetForPositionForComplexText

int Font::offsetForPositionForComplexText(const TextRun& run, const TextStyle& style, int x, bool includePartialGlyphs) const
{
    PangoLayout* layout = getDefaultPangoLayout(run);
    setPangoAttributes(this, run, layout, style.rtl());

    gchar* utf8 = convertUniCharToUTF8(run.characters(), run.length(), 0, run.length());
    pango_layout_set_text(layout, utf8, -1);

    int index, trailing;
    pango_layout_xy_to_index(layout, x * PANGO_SCALE, 1, &index, &trailing);
    glong offset = g_utf8_pointer_to_offset(utf8, utf8 + index);
    g_object_unref(layout);
    g_free(utf8);

    return offset;
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:16,代码来源:FontGdkApollo.cpp

示例5: selectionRectForComplexText

FloatRect Font::selectionRectForComplexText(const TextRun& run, const TextStyle& style, const IntPoint& point, int h,
                                            int from, int to) const
{
    UniscribeController it(this, run, style);
    it.advance(from);
    float beforeWidth = it.runWidthSoFar();
    it.advance(to);
    float afterWidth = it.runWidthSoFar();

    // Using roundf() rather than ceilf() for the right edge as a compromise to ensure correct caret positioning
    if (style.rtl()) {
        it.advance(run.length());
        float totalWidth = it.runWidthSoFar();
        return FloatRect(point.x() + floorf(totalWidth - afterWidth), point.y(), roundf(totalWidth - beforeWidth) - floorf(totalWidth - afterWidth), h);
    } 
    
    return FloatRect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h);
}
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:18,代码来源:FontWin.cpp

示例6: floatWidthForComplexText

float Font::floatWidthForComplexText(const TextRun& run, const TextStyle& style) const
{
    if (run.length() == 0)
        return 0.0f;

    PangoLayout* layout = getDefaultPangoLayout(run);
    setPangoAttributes(this, run, layout, style.rtl());

    gchar* utf8 = convertUniCharToUTF8(run.characters(), run.length(), 0, run.length());
    pango_layout_set_text(layout, utf8, -1);
    g_free(utf8);

    int layoutWidth;
    pango_layout_get_size(layout, &layoutWidth, 0);
    float width = (float)layoutWidth / (double)PANGO_SCALE;
    g_object_unref(layout);

    return width;
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:19,代码来源:FontGdkApollo.cpp


注:本文中的TextStyle::rtl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。