Example #1
0
UniscribeHelperTextRun::UniscribeHelperTextRun(const TextRun& run,
                                               const Font& font)
    : UniscribeHelper(0, run.length(), run.rtl(),
                      font.primaryFont()->platformData().hfont(),
                      font.primaryFont()->platformData().scriptCache(),
                      font.primaryFont()->platformData().scriptFontProperties(),
                      font.primaryFont()->spaceGlyph())
    , m_font(&font)
    , m_fontIndex(0)
{
    if (run.is8Bit()) {
        m_stringFor8BitRun = String::make16BitFrom8BitSource(run.characters8(), run.length());
        setInput(m_stringFor8BitRun.characters16());
    } else {
        setInput(run.characters16());
    }

    setDirectionalOverride(run.directionalOverride());
    setLetterSpacing(font.letterSpacing());
    setSpaceWidth(font.spaceWidth());
    setWordSpacing(font.wordSpacing());
    setAscent(font.fontMetrics().ascent());
    setRangeProperties(font.fontDescription().featureSettings());

    init();

    // Expansion is the amount to add to make justification happen. This
    // should be done after Init() so all the runs are already measured.
    if (run.expansion() > 0)
        justify(run.expansion());
}
UniscribeHelperTextRun::UniscribeHelperTextRun(const TextRun& run,
                                               const Font& font)
    : UniscribeHelper(run.characters(), run.length(), run.rtl(),
                      font.primaryFont()->platformData().hfont(),
                      font.primaryFont()->platformData().scriptCache(),
                      font.primaryFont()->platformData().scriptFontProperties(),
                      font.primaryFont()->spaceGlyph())
    , m_font(&font)
    , m_fontIndex(0)
{
    setDirectionalOverride(run.directionalOverride());
    setLetterSpacing(font.letterSpacing());
    setSpaceWidth(font.spaceWidth());
    setWordSpacing(font.wordSpacing());
    setAscent(font.fontMetrics().ascent());

    init();

    // Expansion is the amount to add to make justification happen. This
    // should be done after Init() so all the runs are already measured.
    if (run.expansion() > 0)
        justify(run.expansion());
}