equal
deleted
inserted
replaced
1630 } |
1630 } |
1631 |
1631 |
1632 PassRefPtr<TextMetrics> CanvasRenderingContext2D::measureText(const String& text) |
1632 PassRefPtr<TextMetrics> CanvasRenderingContext2D::measureText(const String& text) |
1633 { |
1633 { |
1634 RefPtr<TextMetrics> metrics = TextMetrics::create(); |
1634 RefPtr<TextMetrics> metrics = TextMetrics::create(); |
|
1635 |
|
1636 #if PLATFORM(QT) |
|
1637 // We always use complex text shaping since it can't be turned off for QPainterPath::addText(). |
|
1638 Font::CodePath oldCodePath = Font::codePath(); |
|
1639 Font::setCodePath(Font::Complex); |
|
1640 #endif |
|
1641 |
1635 metrics->setWidth(accessFont().width(TextRun(text.characters(), text.length()))); |
1642 metrics->setWidth(accessFont().width(TextRun(text.characters(), text.length()))); |
|
1643 |
|
1644 #if PLATFORM(QT) |
|
1645 Font::setCodePath(oldCodePath); |
|
1646 #endif |
|
1647 |
1636 return metrics; |
1648 return metrics; |
1637 } |
1649 } |
1638 |
1650 |
1639 void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, float y, bool fill, float /*maxWidth*/, bool /*useMaxWidth*/) |
1651 void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, float y, bool fill, float /*maxWidth*/, bool /*useMaxWidth*/) |
1640 { |
1652 { |
1741 return; |
1753 return; |
1742 } |
1754 } |
1743 #endif |
1755 #endif |
1744 |
1756 |
1745 c->setTextDrawingMode(fill ? cTextFill : cTextStroke); |
1757 c->setTextDrawingMode(fill ? cTextFill : cTextStroke); |
|
1758 |
|
1759 #if PLATFORM(QT) |
|
1760 // We always use complex text shaping since it can't be turned off for QPainterPath::addText(). |
|
1761 Font::CodePath oldCodePath = Font::codePath(); |
|
1762 Font::setCodePath(Font::Complex); |
|
1763 #endif |
|
1764 |
1746 c->drawBidiText(font, textRun, location); |
1765 c->drawBidiText(font, textRun, location); |
|
1766 |
|
1767 #if PLATFORM(QT) |
|
1768 Font::setCodePath(oldCodePath); |
|
1769 #endif |
1747 } |
1770 } |
1748 |
1771 |
1749 const Font& CanvasRenderingContext2D::accessFont() |
1772 const Font& CanvasRenderingContext2D::accessFont() |
1750 { |
1773 { |
1751 if (!state().m_realizedFont) |
1774 if (!state().m_realizedFont) |