FontLab Forum
2012-05-16, 12:19:37 *
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: Background scaling, python scripting Adam help  (Read 2528 times)
ArchivePoster
Guest
« on: 2008-09-25, 16:26:00 »

Posted by: mcmathieu
         
[Mac OS 10.5.5 + Fonlab Studio 5.0.4]

Hi,

I'm working on a revival and trying to understand how the Import > Background works (I read the manual part), since I can place an image but have very few control on it. I don't feel like using Illustrator to start drawing as I mostly need my scans in the background to get the proportions.

1. I've noticed that if my images (.tif) don't share the same height, some are scaled in the Background layer. I don't like this behaviour, how can I change that? I want them to reflect the size relation they have in Photoshop.

2. In an old post:
http://groups.msn.com/fontlab/featurerequests.msnw?action=get_message&mview;=0&ID;_Message=2611
Yuri wrote: “It also can be done with very simple Python scripting - bitmap and bitmap rectangle are both accessible from Python. If Adam is reading this, he can provide more information on imaging in FontLab.”
I've visited the Unofficial FontLab/Python API Reference page but I'm mixing things: Image, Background layer, Image rectangle… Adam, can you provide more information? I'd like to script the scaling of all background images, with a precise value.

By the way, I can't make the Search option work on the forum.

Thanks for your help, best regards,

Mathieu
         
Logged
ArchivePoster
Guest
« Reply #1 on: 2008-09-28, 18:20:00 »

Posted by: mcmathieu
         
Yuri, Adam,

In the meantime, I wrote a script that removes all background pictures in an opened font, you never know it might be useful, but I can't manage to scale the picture.

I looked everywhere on this page but nothing works for me. I extracted what might seem to be relevant below.
http://www.dev.fontlab.net/flpydoc/

MenuCommands:
Bitmapmenu100Scale
Image:
Can't find a scale method, the width/height attribute is read only.
Glyph:
 (Image, layer {, Height}) | (Image, WeightVector {, Height})
- rasterizes the current glyph into Image object; Height parameter is the rasterized pixel size of the em square, if absent, source height of the image will be used. Rasterize returns image_rect - rectangle used to fit image into the glyph space. (extended parameters are new in v4.61)

Yuri or Adam, please let me know if scaling the image in the background is possible. I'm also very concerned about my images being automatically scaled when I import them…

Thanks, M
         
Logged
ArchivePoster
Guest
« Reply #2 on: 2008-09-28, 20:24:00 »

Posted by: Tim Ahrens
         

Hi Mathieu,

this is from a macro I wrote quite a while ago:

for i in range(len(f)):
  f.image_rect = Rect(0, 0, f.image.width*4, f.image.height*4)
  f.width = f.image.width*4

[Don't forget to add indents, they probably get removed in this forum.]

I can't quite remember what this does but it might be helpful in your case.

Tim
         
Logged
Tags:
Pages: [1]
  Print  
 
Jump to:  

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