aligning different fonts (sizes)

hi,

i want to align to strings with different font-sizes with same baseline -
how to do that?

take this example: “Gg” and “09”

when i draw this strings, they are aligned with there bounding boxes so
the strings appear not aligned with same baseline :frowning:

mirtch <mirtch@gmx.net> wrote:

hi,

i want to align to strings with different font-sizes with same baseline -
how to do that?

take this example: “Gg” and “09”

when i draw this strings, they are aligned with there bounding boxes so
the strings appear not aligned with same baseline > :frowning:

Same font, or different? Please post your “small” test case.
In most cases, it is possible to align baselines from different
fonts, but sometimes intrinsic, unavoidable rounding errors
occur when going from 16.16 to pixel grid-fitting. Again,
please post a “small” test case.

Regards.

ok here’s my test case: 90,0 MHz

the number maybe of size 29 and the unit string of size 12 with same font
for simplicity…the problem is: the two strings are aligned with there
bounding boxes and so they appear in diffferent y-positions

regards,
mirtch

Derek Leach wrote:

mirtch <> mirtch@gmx.net> > wrote:
hi,

i want to align to strings with different font-sizes with same baseline -
how to do that?

take this example: “Gg” and “09”

when i draw this strings, they are aligned with there bounding boxes so
the strings appear not aligned with same baseline > :frowning:

Same font, or different? Please post your “small” test case.
In most cases, it is possible to align baselines from different
fonts, but sometimes intrinsic, unavoidable rounding errors
occur when going from 16.16 to pixel grid-fitting. Again,
please post a “small” test case.

Regards.

mirtch <mirtch@gmx.net> wrote:

ok here’s my test case: 90,0 MHz

the number maybe of size 29 and the unit string of size 12 with same font
for simplicity…the problem is: the two strings are aligned with there
bounding boxes and so they appear in diffferent y-positions

regards,
mirtch

Let me get this straight, the string “90,0” is in 29 point, and
the string “MHz” is in 12 point? Well, the height of a string
is (extent.lr.y - extent.ul.y + 1). extent.ul.y is the ascender,
extent.lr.y is the descender. You need to find the difference between
the two ascenders, and apply the difference to the position
of the string rendered in the smaller font size.

Regards.

Derek Leach wrote:

mirtch <> mirtch@gmx.net> > wrote:
hi,

i want to align to strings with different font-sizes with same baseline -
how to do that?

take this example: “Gg” and “09”

when i draw this strings, they are aligned with there bounding boxes so
the strings appear not aligned with same baseline > :frowning:

Same font, or different? Please post your “small” test case.
In most cases, it is possible to align baselines from different
fonts, but sometimes intrinsic, unavoidable rounding errors
occur when going from 16.16 to pixel grid-fitting. Again,
please post a “small” test case.

Regards.