Two questions about embedded tables (python)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Two questions about embedded tables (python)

Abraham Lee
All,

I use FontForge's python scripting capabilities all the time (it is heaven-sent for my work). I have two questions about embedded tables:

1. Is it possible to keep non-standard tables from getting tossed when opening a file? 

I know it's possible when using the GUI, but I can't seem to determine the proper syntax for doing this via python scripting.

In the docs, it gives the function definition as

fontforge.open(filename[, flags])

with the description:

Opens a filename and returns the font it contains. If it does.

If the flags argument is 4, then ff will load all glyphs in the 'glyf' table of a ttc file (rather than just the glyphs used in the font picked). This will not load all 'glyf' tables though.

Am I supposed to be able to access them this way? The variable "flags" is supposed to be an integer, and it doesn't seem to matter what integer I put in there, so I'm not sure what to do.

2. I'm also aware that you can access and embed any table in the font via "getTableData" and "setTableData", respectively. These functions speak of the data being in a "binary string" format. When keeping a non-standard table in the GUI, they are encoded in the ascii85 format. Is this the format they are referring to? If not, that's fine, I'd just like to know what the correct format is.

Thanks, everyone! Any insight would be very much appreciated!

Best,
Abraham

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
fontforge-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fontforge-users
http://fontforge.10959.n7.nabble.com/User-f8781.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Two questions about embedded tables (python)

marty39
Abraham Lee wrote
*1. Is it possible to keep non-standard tables from getting tossed when
opening a file? *

I know it's possible when using the GUI, but I can't seem to determine the
proper syntax for doing this via python scripting....

2. I'm also aware that you can access and embed any table in the font via
"getTableData" and "setTableData", respectively. These functions speak of
the data being in a "binary string" format. When keeping a non-standard
table in the GUI, they are encoded in the ascii85 format. *Is this the
format they are referring to?* If not, that's fine, I'd just like to know
what the correct format is....
Not an answer but a further question. How does the GUI provide for preserving tables that FontForge can't parse?

In Menu, File, Preferences, Open Font, Preserve Tables, I can enter a list of four-letter tags of tables I want preserved, and they will be saved in binary format (not "ascii85"). The only options in the File Open dialog are font file filtering and glyph renaming. Am I missing something?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Two questions about embedded tables (python)

Abraham Lee
marty89,

On Mon, Feb 29, 2016 at 10:06 AM, marty39 <[hidden email]> wrote:
Abraham Lee wrote
> *1. Is it possible to keep non-standard tables from getting tossed when
> opening a file? *
>
> I know it's possible when using the GUI, but I can't seem to determine the
> proper syntax for doing this via python scripting....
>
> 2. I'm also aware that you can access and embed any table in the font via
> "getTableData" and "setTableData", respectively. These functions speak of
> the data being in a "binary string" format. When keeping a non-standard
> table in the GUI, they are encoded in the ascii85 format. *Is this the
> format they are referring to?* If not, that's fine, I'd just like to know
> what the correct format is....

Not an answer but a further question. How does the GUI provide for
preserving tables that FontForge can't parse?

In Menu, File, Preferences, Open Font, Preserve Tables, I can enter a list
of four-letter tags of tables I want preserved, and they will be saved in
binary format (not "ascii85"). The only options in the File Open dialog are
font file filtering and glyph renaming. Am I missing something?

In that preferences area, the four-letter tags must be comma-separated without spaces (if there are more than one to be preserved), like "ABCD,EFGH,JKLM". With that set, if I open a file that has any these tables embedded, then save the font to an SFD file, the tables are preserved in raw ascii85 format that you can view in any text editor. I have been utilizing a python script to access them directly from the SFD text file in this format and then decode them into normal ascii so I can read them.

Since sending my first message, I learned through experimentation that getTableData returns the decoded table data (in ascii format) and setTableData expects its "sequence" input to be in normal ascii format, which is EXACTLY what I wanted!

Best,
Abraham

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
fontforge-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fontforge-users
http://fontforge.10959.n7.nabble.com/User-f8781.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Two questions about embedded tables (python)

Abraham Lee

On Mon, Feb 29, 2016 at 1:43 PM, Abraham Lee <[hidden email]> wrote:
marty89,

On Mon, Feb 29, 2016 at 10:06 AM, marty39 <[hidden email]> wrote:
Abraham Lee wrote
> *1. Is it possible to keep non-standard tables from getting tossed when
> opening a file? *
>
> I know it's possible when using the GUI, but I can't seem to determine the
> proper syntax for doing this via python scripting....
>
> 2. I'm also aware that you can access and embed any table in the font via
> "getTableData" and "setTableData", respectively. These functions speak of
> the data being in a "binary string" format. When keeping a non-standard
> table in the GUI, they are encoded in the ascii85 format. *Is this the
> format they are referring to?* If not, that's fine, I'd just like to know
> what the correct format is....

Not an answer but a further question. How does the GUI provide for
preserving tables that FontForge can't parse?

In Menu, File, Preferences, Open Font, Preserve Tables, I can enter a list
of four-letter tags of tables I want preserved, and they will be saved in
binary format (not "ascii85"). The only options in the File Open dialog are
font file filtering and glyph renaming. Am I missing something?

In that preferences area, the four-letter tags must be comma-separated without spaces (if there are more than one to be preserved), like "ABCD,EFGH,JKLM". With that set, if I open a file that has any these tables embedded, then save the font to an SFD file, the tables are preserved in raw ascii85 format that you can view in any text editor. I have been utilizing a python script to access them directly from the SFD text file in this format and then decode them into normal ascii so I can read them.

Since sending my first message, I learned through experimentation that getTableData returns the decoded table data (in ascii format) and setTableData expects its "sequence" input to be in normal ascii format, which is EXACTLY what I wanted!

Best,
Abraham

My first question still stands, BTW.

- Abraham

------------------------------------------------------------------------------

_______________________________________________
fontforge-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/fontforge-users
http://fontforge.10959.n7.nabble.com/User-f8781.html
Loading...