Pango and ink rectangles
- From: Sven Neumann <sven gimp org>
- To: gtk-devel-list gnome org
- Subject: Pango and ink rectangles
- Date: 14 Aug 2001 16:59:59 +0200
Hi,
while writing the new text tool for The GIMP, I encountered some
problems related to ink rectangles. I suspect the PangoFT2 backend
does not return correct values here. Before trying to fix this,
I'd like to ask a few questions to check that I understood the
terminolgy correctly.
Pango supports two rectangles, the logical and the ink rectangle.
Am I right to assume that the ink rectangle is supposed to be the
bounding box of the drawn glyph or layout and that I should be
able to rely on the fact that a buffer created with the dimensions
taken from the ink rectangle should be large enough but not too
large to hold the rendered string (assuming I choose a correct
offset to position the layout in my buffer)? According to the
documentation, the origins of both the ink and the logical
rectangle are located on the baseline as illustrated below. I'm
using an italic "g" in a serif font here to show how the ink
rectangle can exceed the logical rectangle.
|
|
| __aaaaaas,,
| awQ ?^ ~?WQQQQQQQQW`
| aQWWF )WQQQT???^
|.mQQQF QQQQ[
|jQQQ@ <QQQQ[
|QQQQf dQQQ@
|4QQQL jQQQP`
| 4QQQc _yQQV^
| -?9WmwaaadT?"`
----+---------------------------
| _mQQ;
| QQQQQgaa,,,
| )QQQQQQQQQQQmya,.
.<|mT^ --"?TT$QQQQQQQa
jQQ|' -"?$QQQr
dQQW| 4QQ(
$QQQ| jQF
-9QQ|a. _sdT'
"|YVGwaaaaa%%%?!`
|
For this example, the ink and logical rectangles are
in arbitrary units (characters for this ASCII example):
ink rectangle: x = -4
y = -9
width = 31
height = 19
---------------------------------
| __aaaaaas,, |
| awQ ?^ ~?WQQQQQQQQW`|
| aQWWF )WQQQT???^ |
| .mQQQF QQQQ[ |
| jQQQ@ <QQQQ[ |
| QQQQf dQQQ@ |
| 4QQQL jQQQP` |
| 4QQQc _yQQV^ |
| | -?9WmwaaadT?"` |
-----+---------------------------
| | _mQQ; |
| QQQQQgaa,,, |
| )QQQQQQQQQQQmya,. |
| .<wmT^ --"?TT$QQQQQQQa |
| jQQD' -"?$QQQr |
|dQQW` 4QQ( |
|$QQQ, jQF |
|-9QQQa. _sdT' |
| "?YVGwaaaaa%%%?!` |
---------------------------------
logical rectangle: x = 0 (always zero)
y = -15
width = 20
height = 23
------------------------
| |
| |
| |
| |
| |
| |
| __aaaaaas,, |
| awQ ?^ ~?WQQQQQQ|QW`
| aQWWF )WQQQT?|?^
|.mQQQF QQQQ[ |
|jQQQ@ <QQQQ[ |
|QQQQf dQQQ@ |
|4QQQL jQQQP` |
| 4QQQc _yQQV^ |
| -?9WmwaaadT?"` |
-+------------------------
| _mQQ; |
| QQQQQgaa,,, |
| )QQQQQQQQQQQmya,. |
.<|mT^ --"?TT$QQQQQQQa |
jQQ|' -"?$QQQr |
dQQW| 4QQ( |
$QQQ| jQF |
-9QQ|a. _sdT' |
"------------------------
Is this correct? If so, the PangoFT2 implementation fails to
provide this data correctly. I can provide a patch that corrects
this behaviour.
Salut, Sven
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]