freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] Wrote a tiny Python 3 script to extract SVG Documents out


From: suzuki toshiya
Subject: Re: [ft-devel] Wrote a tiny Python 3 script to extract SVG Documents out of a OT-SVG font
Date: Sat, 18 May 2019 14:18:29 +0000

Dear Moazin,

Wow, great! It would be very meaningful for you to have your own handaxe to
enter the jungle of unfamiliar softwares, because you can understand the
behaviour of your own handaxe completely. Although I've just taken a glance on
your code, I'm sure it's very clean and no need to have more document. Your code
explains itself, very well (so, in the educational context, I appreciate your
publishing your own code)

> I know tools like these can be easily found online. I just did it as to get 
> some practice, since I'd be eventually doing this in C inside FreeType when 
> my coding time starts. I'd be happy if this helps anyone! :)

I understand, I have almost same experience. Before macOS font support in
FreeType2, I've implemented in Perl, then in Ruby, and finally in C. Writing a
parse is very helpful to understand the specification. I appreciate your
DIY-like motivation deeply. In fact, there are other font file parsing
libraries, but due to their huge feature set, sometimes it is not easy for the
beginners to read. Reading a small code for simple task (but in generic design)
would be very helpful for the beginners, I believe.

Regards,
mpsuzuki

Moazin Khatri wrote:
> Hi Toshiya,
> 
> However, to proceed to next step, I should prepare some sample SVGs which are 
> precisely fitting to the feature range of SVG Native,
> and which we can understand "correct" rendering result. It seems that 
> svgnative/test files are not precisely
> fitting to the feature range of SVG Native (thus, testSkia result is 
> different from that by rsvg-convert).
> 
> I have written a very small Python 3 script that can read OT files and 
> extract SVG documents out of it.
> 
> You can find it here: 
> https://github.com/moazin/font-file-reader<https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmoazin%2Ffont-file-reader&data=02%7C01%7Cmpsuzuki%40hiroshima-u.ac.jp%7C29cbc251a44e41f430bb08d6db909818%7Cc40454ddb2634926868d8e12640d3750%7C1%7C0%7C636937811404891937&sdata=WrjiyLvT1X6oacUqgBpdNugYqNkV5dEyBxqS8WS3NRo%3D&reserved=0>
> 
> I have tried to make it generalized enough so that it can be easily modified 
> to support more tables. For now, the README will tell you the default 
> behavior of the script. It can be modified with a basic knowledge of Python. 
> If you want me to document it or if you have any questions, feel free to ask 
> me, I'd love to help.
> 
> You can extract the glyphs using this script and render them using any tool 
> you want. However, your browser and some other SVG renderers might not render 
> these properly because of the coordinate system inversion.  However, I have 
> found an online editor that can show you the results. You can find it here 
> http://vectorpaint.yaks.co.nz/<https://jpn01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvectorpaint.yaks.co.nz%2F&data=02%7C01%7Cmpsuzuki%40hiroshima-u.ac.jp%7C29cbc251a44e41f430bb08d6db909818%7Cc40454ddb2634926868d8e12640d3750%7C1%7C0%7C636937811404891937&sdata=AyB7rEy5iKRWyUMznC%2FybughZA8Stab0ZukVgn6MAJE%3D&reserved=0>.
>  You'll need to zoom out to see the glyph (because of coordinate system 
> inversion again).
> 
> You can grab some free SVG based fonts from here:  
> https://www.colorfonts.wtf/<https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.colorfonts.wtf%2F&data=02%7C01%7Cmpsuzuki%40hiroshima-u.ac.jp%7C29cbc251a44e41f430bb08d6db909818%7Cc40454ddb2634926868d8e12640d3750%7C1%7C0%7C636937811404901934&sdata=jvz%2FG9%2FYOJOatkKDzs%2F%2F8e9E8g8OjUKSWjuJzh4mYsM%3D&reserved=0>
> 
> Note that this is very basic and might not work with all fonts. Also, GZIP 
> encoded SVG documents are not supported at the moment.
> 
> I know tools like these can be easily found online. I just did it as to get 
> some practice, since I'd be eventually doing this in C inside FreeType when 
> my coding time starts. I'd be happy if this helps anyone! :)
> 
> Regards,
> Moazin
> 
> 
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]