equal
deleted
inserted
replaced
1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
8 ** |
8 ** |
355 ++current; |
355 ++current; |
356 } |
356 } |
357 ++i; |
357 ++i; |
358 } |
358 } |
359 } else { |
359 } else { |
360 positions.resize(glyphs.numGlyphs); |
|
361 glyphs_out.resize(glyphs.numGlyphs); |
|
362 int i = 0; |
|
363 while (i < glyphs.numGlyphs) { |
360 while (i < glyphs.numGlyphs) { |
364 if (!glyphs.attributes[i].dontPrint) { |
361 if (!glyphs.attributes[i].dontPrint) { |
365 QFixed gpos_x = xpos + glyphs.offsets[i].x; |
362 QFixed gpos_x = xpos + glyphs.offsets[i].x; |
366 QFixed gpos_y = ypos + glyphs.offsets[i].y; |
363 QFixed gpos_y = ypos + glyphs.offsets[i].y; |
367 QPointF gpos(gpos_x.toReal(), gpos_y.toReal()); |
364 QPointF gpos(gpos_x.toReal(), gpos_y.toReal()); |
380 positions.resize(current); |
377 positions.resize(current); |
381 glyphs_out.resize(current); |
378 glyphs_out.resize(current); |
382 Q_ASSERT(positions.size() == glyphs_out.size()); |
379 Q_ASSERT(positions.size() == glyphs_out.size()); |
383 } |
380 } |
384 |
381 |
|
382 void QFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) |
|
383 { |
|
384 glyph_metrics_t gi = boundingBox(glyph); |
|
385 bool isValid = gi.isValid(); |
|
386 if (leftBearing != 0) |
|
387 *leftBearing = isValid ? gi.x.toReal() : 0.0; |
|
388 if (rightBearing != 0) |
|
389 *rightBearing = isValid ? (gi.xoff - gi.x - gi.width).toReal() : 0.0; |
|
390 } |
385 |
391 |
386 glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs) |
392 glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs) |
387 { |
393 { |
388 glyph_metrics_t overall; |
394 glyph_metrics_t overall; |
389 |
395 |
1386 glyphs.glyphs[i] = hi | glyphs.glyphs[i]; |
1392 glyphs.glyphs[i] = hi | glyphs.glyphs[i]; |
1387 |
1393 |
1388 return overall; |
1394 return overall; |
1389 } |
1395 } |
1390 |
1396 |
|
1397 void QFontEngineMulti::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) |
|
1398 { |
|
1399 int which = highByte(glyph); |
|
1400 engine(which)->getGlyphBearings(stripped(glyph), leftBearing, rightBearing); |
|
1401 } |
|
1402 |
1391 void QFontEngineMulti::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, |
1403 void QFontEngineMulti::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, |
1392 QPainterPath *path, QTextItem::RenderFlags flags) |
1404 QPainterPath *path, QTextItem::RenderFlags flags) |
1393 { |
1405 { |
1394 if (glyphs.numGlyphs <= 0) |
1406 if (glyphs.numGlyphs <= 0) |
1395 return; |
1407 return; |