Hi,
how can I get empty glyph’s height? I tried to search this forum and api include wrapper, I couldn’t find it. I used below code to get glyph height. But in case the empty glyph’s height is different from ascender - descender, how can I get it?
gHeight = activeLayer.bounds.size.height + activeLayer.TSB + activeLayer.BSB
if 0 == gHeight and 0 == activeLayer.bounds.size.width:
gHeight = ascender - descender
Thanks in advance!
I don’t understand. What heigh do you mean if the glyph is empty? What do you need the value for?
And why do you subtract activeLayer.TSB + activeLayer.BSB
?
I am developing vertical preview plugin and I need the glyph height for vertical writing(which is saved to vmtx table).
Thanks,
There is a property layer.vertOrigin
and layer.vertWidth. if vertOrigin or vertWidth are bigger than 10000, use the ascender (for origin) or ascender - descender for width.
1 Like
Question 1
It seems that layer.BSB isn’t updated or is cached to the glyph that is opened while changing the font’s descender value.
this is the way I tested.
- open a glyph(tab1: text ‘A’)
- print layer.BSB
- open font info and change descender value by -100(or other value)
- close the tab1
- reopen a glyph(tab1: text ‘A’)
- print layer.BSB
if I compare the value layer.BSB in 2 and layer.BSB in 6, it shows the same value.
other glyphs which isn’t opened previously has right BSB values.
is it due to cached memory or update error? if it is from cached memory, how can I update it?
Question 2
layer.vertWidth() returns -1 for the glyphs with default height. right?
Then can I get its height with below code?
gHeight = layer.vertWidth()
if gHeight < 0:
gHeight = font.ascender - font.descender
Thanks,
1 Like