equal
deleted
inserted
replaced
470 |
470 |
471 QGlyphLayoutArray<10> glyphs; |
471 QGlyphLayoutArray<10> glyphs; |
472 int nglyphs = 9; |
472 int nglyphs = 9; |
473 engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0); |
473 engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0); |
474 // ### can nglyphs != 1 happen at all? Not currently I think |
474 // ### can nglyphs != 1 happen at all? Not currently I think |
475 glyph_metrics_t gi = engine->boundingBox(glyphs.glyphs[0]); |
475 qreal lb; |
476 return qRound(gi.x); |
476 engine->getGlyphBearings(glyphs.glyphs[0], &lb); |
|
477 return qRound(lb); |
477 } |
478 } |
478 |
479 |
479 /*! |
480 /*! |
480 Returns the right bearing of character \a ch in the font. |
481 Returns the right bearing of character \a ch in the font. |
481 |
482 |
504 |
505 |
505 QGlyphLayoutArray<10> glyphs; |
506 QGlyphLayoutArray<10> glyphs; |
506 int nglyphs = 9; |
507 int nglyphs = 9; |
507 engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0); |
508 engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0); |
508 // ### can nglyphs != 1 happen at all? Not currently I think |
509 // ### can nglyphs != 1 happen at all? Not currently I think |
509 glyph_metrics_t gi = engine->boundingBox(glyphs.glyphs[0]); |
510 qreal rb; |
510 return qRound(gi.xoff - gi.x - gi.width); |
511 engine->getGlyphBearings(glyphs.glyphs[0], 0, &rb); |
|
512 return qRound(rb); |
511 } |
513 } |
512 |
514 |
513 /*! |
515 /*! |
514 Returns the width in pixels of the first \a len characters of \a |
516 Returns the width in pixels of the first \a len characters of \a |
515 text. If \a len is negative (the default), the entire string is |
517 text. If \a len is negative (the default), the entire string is |
1315 |
1317 |
1316 QGlyphLayoutArray<10> glyphs; |
1318 QGlyphLayoutArray<10> glyphs; |
1317 int nglyphs = 9; |
1319 int nglyphs = 9; |
1318 engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0); |
1320 engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0); |
1319 // ### can nglyphs != 1 happen at all? Not currently I think |
1321 // ### can nglyphs != 1 happen at all? Not currently I think |
1320 glyph_metrics_t gi = engine->boundingBox(glyphs.glyphs[0]); |
1322 qreal lb; |
1321 return gi.x.toReal(); |
1323 engine->getGlyphBearings(glyphs.glyphs[0], &lb); |
|
1324 return lb; |
1322 } |
1325 } |
1323 |
1326 |
1324 /*! |
1327 /*! |
1325 Returns the right bearing of character \a ch in the font. |
1328 Returns the right bearing of character \a ch in the font. |
1326 |
1329 |
1349 |
1352 |
1350 QGlyphLayoutArray<10> glyphs; |
1353 QGlyphLayoutArray<10> glyphs; |
1351 int nglyphs = 9; |
1354 int nglyphs = 9; |
1352 engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0); |
1355 engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0); |
1353 // ### can nglyphs != 1 happen at all? Not currently I think |
1356 // ### can nglyphs != 1 happen at all? Not currently I think |
1354 glyph_metrics_t gi = engine->boundingBox(glyphs.glyphs[0]); |
1357 qreal rb; |
1355 return (gi.xoff - gi.x - gi.width).toReal(); |
1358 engine->getGlyphBearings(glyphs.glyphs[0], 0, &rb); |
|
1359 return rb; |
|
1360 |
1356 } |
1361 } |
1357 |
1362 |
1358 /*! |
1363 /*! |
1359 Returns the width in pixels of the characters in the given \a text. |
1364 Returns the width in pixels of the characters in the given \a text. |
1360 |
1365 |