FontLab Forum
2012-02-08, 21:20:52 *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to the FontLab forum, read how to use it! Update: Archives from old MSN forums are now available on our forum.
 
   Home   Help Search Calendar Downloads Tags Login Register  
Del.icio.us Digg FURL FaceBook Stumble Upon Reddit SlashDot

Pages: [1]
  Print  
Author Topic: Accessing Glyph.mask.width via macro?  (Read 2789 times)
Jens
Beta: FontLab Studio Mac
Hero Member
***

Karma: +0/-0
Germany Germany

Posts: 23


WWW
« on: 2010-03-23, 12:28:51 »

Hi!

I'm trying to access the width attribute of a glyph's mask via macro. I activated "Mask layer has its own metrics" in the FLS settings.

Code:
def compareMetrics(f, g, i): # font, glyph, glyphindex
if hasattr(g.mask, "width"):
print g.name, g.mask.width
else:
print g.name, "has no mask with attribute width"

fl.ForSelected(compareMetrics)

The result is, either there is no width (if a glyph has no mask), or if the glyph has a mask, the width is always reported as 0.

Is there any way to get the real mask width?

Thanks,
Jens
Logged
Tim Ahrens
Beta: FontLab Studio Win
Hero Member
***

Karma: +2/-0
Germany Germany

Posts: 41



WWW
« Reply #1 on: 2010-03-23, 12:35:19 »

I don't think you can access the advance width of the mask directly.

You can see my solution in the RMX Tuner (see http://remix-tools.com), starting in line 84:
 - store current advance width
 - use fl.CallCommand() for "mask mertics to master" (this seems to be platform-specific)
 - get the advance width
 - restore old advance width
 - dont't forget the sanity check for the obtained mask advance width

Tim
Logged
Jens
Beta: FontLab Studio Mac
Hero Member
***

Karma: +0/-0
Germany Germany

Posts: 23


WWW
« Reply #2 on: 2010-03-24, 12:43:52 »

Thanks, Tim! I managed to follow the example of your script Smiley

Cheers,
Jens
Logged
Adam Twardoch (FontLab)
Product and marketing manager, Fontlab Ltd.
Administrator
Hero Member
*****

Karma: +12/-4
Germany Germany

Posts: 304


FontLab Studio 5.0.4, Mac OS X 10.4.11


WWW
« Reply #3 on: 2010-03-25, 08:10:12 »

The fact that Glyph().mask.width is reported as 0 rather than the actual width is a bug. I hope we will fix it in the next major version of FLS.
Adam
Logged
nlsp
Jr. Member
**

Karma: +0/-0
Netherlands Netherlands

Posts: 1


« Reply #4 on: 2011-07-24, 13:36:20 »

The fact that Glyph().mask.width is reported as 0 rather than the actual width is a bug. I hope we will fix it in the next major version of FLS.
Adam
Hi Adam  Smiley

Any chance we will see this fixed in any currently scheduled FontLab release?

Thanks...

Niels
Logged
Tags: glyph mask width 
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!