Where can I find Font parsing or Text rasterization algorithm

New Here ,
Mar 14, 2010 Mar 14, 2010

Copy link to clipboard

Copied

Hello,

I am working on a project where I need to get graphic outline details (like line, curve, etc) from the font files (.otf, .cff, .ttf,  etc) for given character.

For example: I have .cff font file and a character (say character 'A'). using that I want the actual graphical information for that character which can be printed to bitmap canvas.

I am using c#.Net and ultimately I want to create captcha (http://en.wikipedia.org/wiki/CAPTCHA) runtime. But I dont want to install the fonts in my windows directory.

I am not sure whether this technique is known as font parsing or text rasterization, What is the correct name of this technique?

Can anyone please provide me the information about the algorithm?

Thanks,

Hardik

Views

1.1K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 14, 2010 Mar 14, 2010

Copy link to clipboard

Copied

Getting a bitmap representation of a font is called font rasterization. If the font is not already installed at a system level, font parsing is also needed.

It is possible to use Windows APIs to activate a font without placing it in the system directory. A font may even be activated for a single process (your application) rather than globally. Then you can use a Windows system call to get the rasterization. That's really your easiest route to get what you need.

If you really want to rasterize it yourself, this is a quite complex task, not a simple algorithm. I'd suggest you look at off-the-shelf libraries such as FreeType (http://www.freetype.org/). FreeType does font parsing and rasterization both.

Regards,

T

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 15, 2010 Mar 15, 2010

Copy link to clipboard

Copied

LATEST

Hello Thomas,

Thanks a lot for providing useful suggestion.

My project will be hosted to some third party vendor's machine and will run in IIS using ASP.Net. So I need to check how I could use the Windows API.

I will also check Freetype for how can I use it with my application.

Further to this I found one more source of information: http://www.java2s.com/Open-Source/Java-Document/PDF/PDF-Renderer/com.sun.pdfview.font.htm

It seems that it has source code of font parsers, I am not sure though!

For my project I don't need excellent and perfect human readable rasterized text. I just want to take out the curves which form the characters. So that I can modify them a bit and draw to the captcha image.

Could you please provide some reference material where I can check how the process happens?

Thanks,

Hardik

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines