Yves Daoust | 18 Jun 2013 11:05
Picon

[ft] Text outline rendering

 

                Hi All,

 

I am new to FreeType.

 

I am involved in a project where text needs to be rendered in vector form. I mean I have text strings, font information (TTF), possible geometric transforms, and I need to generate the corresponding outlines in vector form (sequences of Bezier arcs, so just lists of control point coordinates; I don’t need the rendered bitmap).

 

After a first search in the documentation, I am convinced that all the required machinery is there but I want to be sure this is feasible. If yes, where can I start ?

 

Regards,

 

                Yves Daoust

 

_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype
Ulrich Eckhardt | 11 Jun 2013 13:09
Favicon

[ft] Clarification about FT_Init_FreeType in a multithreaded environment

Greetings!

I'm currently making a few tests with the goal of reading vector fonts 
for use in laser marking. For that, I only need the outline, not any 
bitmap outputs. As far as the raw functionality goes, FreeType provides 
the required information, there are a few questions open though...

The documentation for FT_Init_FreeType says "For multi-threading 
applications each thread should have its own FT_Library object." and I'm 
wondering how to understand this sentence. Is this meant as "don't 
access FT_Library objects concurrently from different threads" or does 
every thread have to create its own library instance and I can't move 
objects between threads? I assume the former, but I'd like to clarify 
that first.

The reason I ask is the way I'm currently loading fonts. Our system is 
based on MS Windows CE5 and it is very restricted concerning memory. For 
that reason, I have a central repository that manages loading fonts on 
demand and unloading on memory shortage. However, this code is called 
from multiple threads (with a mutex, of course), and having one library 
per thread kind-of defeats the purpose of sharing data.

What I would create is:
1. One central instance of the libary (FT_Library), guarded by a 
"library" mutex.
2. A cache of FT_Face instances, each guarded by its own "face" mutex.

When rendering text, I would
1. Lock the library mutex.
2. If the faces is not cached, load it now and store it in the cache.
3. Then, lock the face mutex and release the library mutex.
4. Load the glyphs and render their outlines.
5. Release the face mutex.

My question in that context is whether the two-level approach to locking 
works, i.e. if I can call FT_Load_Char() and FT_Outline_Decompose() on 
the face while some other thread calls FT_New_Face() on the library. If 
not, could I get the above level of separation if I had one library 
instance per face? What is the overhead of creating a library instance?

BTW: It would have helped me understand the FreeType API if every 
resource-acquiring function had their release counterpart documented. 
This is already done for FT_New_Memory_Face()/FT_Open_Face() and 
FT_Done_Face(), but what about FT_New_Face()? Also, what is still not 
completely clear to me is when I can use FT_Done_FreeType(). For the 
faces, it seems that they are reference-counted, but what about the 
library itself? Will an early call pull the library from under my feet?

Please CC me on replies, as I'm not subscribed to the mailinglist. I can 
read the archives online, but it's difficult to respond without breaking 
threads then.

Thank you for your time!

Uli
**************************************************************************************
Domino Laser GmbH, Fangdieckstraᅵe 75a, 22547 Hamburg, Deutschland
Geschᅵftsfᅵhrer: Hans Robert Dapprich, Amtsgericht Hamburg HR B62 932
**************************************************************************************
Visit our website at http://www.dominolaser.com
**************************************************************************************
Diese E-Mail einschlieᅵlich sᅵmtlicher Anhᅵnge ist nur fᅵr den Adressaten
bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender
umgehend, falls Sie nicht der beabsichtigte Empfᅵnger sein sollten. Die E-Mail ist in diesem Fall
zu lᅵschen und darf weder gelesen, weitergeleitet, verᅵffentlicht oder anderweitig
benutzt werden.
E-Mails kᅵnnen durch Dritte gelesen werden und Viren sowie nichtautorisierte ᅵnderungen
enthalten. Domino Laser GmbH ist fᅵr diese Folgen nicht verantwortlich.
**************************************************************************************
Timothy Gu | 8 Jun 2013 05:48
Picon

[ft] Compability between LGPL v2.1 and Freetype License

Hello,

I am involved in an LGPL v2.1-licensed project, FFmpeg. We want to know
whether we can link to libfreetype without changing license. From
http://lists.gnu.org/archive/html/freetype/2010-11/msg00013.html , we already
know that FTL is a LGPL v3-compatible license. And from your website, we know
that FTL is incompatible with GPL v2. So, is FTL LGPL v2.1-compatible?

Also, is there any distinctive difference between FTL and 3-clause BSD except
for the fact that FTL is longer? This will help us clarify the license
relationship with other projects.

Thank you.

Timothy Gu
Gregor Mückl | 2 Jun 2013 18:13
Picon
Picon

[ft] Freetype 2.4.4 -> freetype 2.4.12: FT_Get_Advance changed behaviour?

Hi!

I've upgraded a project of mine from using freetype 2.4.4 to freetype 
2.4.12 and now I experience totally broken text layouting (the layouting 
code is my own). Horizontal spacings between characters are now either 
far too large or far too small, depending on the font. In one case the 
glyph distances are at least double what they should be. None of the 
tested fonts give anything close to believable reasults. Linking against 
the old version of freetype without any further code changes fixes this 
issue.

I seem to get vastly different values for the horizontal advance. If I 
uncommend the if block around FT_HAS_KERNING in the code below, the 
result does not change noticably. This is the code I use to compute the 
horizontal layout of a string of glyphs:

typedef struct {
	unsigned int glyph;
	float posX;
	float posY;
	int lineNumber;
	int font;
	int size;
} TL_GlyphPosition;

void _TL_ActivateFontSize(int font, int size)
{
	if(TL_Globals.fonts[font].currentSize==size) {
		return;
	}

	FT_Set_Pixel_Sizes(TL_Globals.fonts[font].face,0,size);
	TL_Globals.fonts[font].currentSize=size;

	int
height=TL_Globals.fonts[font].face->size->metrics.height;
	if(height<TL_Globals.fonts[font].face->size->metrics.ascender+TL_Globals.fonts[font].face->size->metrics.descender) {
	 
height=TL_Globals.fonts[font].face->size->metrics.ascender+TL_Globals.fonts[font].face->size->metrics.descender;
	}
	TL_Globals.fonts[font].currentLineHeight=height;
}

int _TL_CalculateRunWidth(TL_GlyphPosition *glyphs, int length, bool 
firstInLine)
{
	int width=0;
	FT_Vector kerning;
	FT_Fixed advance;
	int i;

	for(i=0;i<length;i++) {
		glyphs[i].posX=(float)width;
		glyphs[i].posY=0;

		// get character width of current character
		_TL_ActivateFontSize(glyphs[i].font,glyphs[i].size);
	 
FT_Get_Advance(TL_Globals.fonts[glyphs[i].font].face,glyphs[i].glyph,FT_LOAD_DEFAULT,&advance);
	 
advance=(FT_Fixed)(64*advance/(float)TL_Globals.fonts[glyphs[i].font].face->size->metrics.x_scale);
		width+=advance;

		// check whether this is the first character in the string/line
		if((i==0 && !firstInLine) || i!=0) {
			// respect proper kerning (if possible, i.e. both glyphs are from the 
same font and size)
			if(FT_HAS_KERNING(TL_Globals.fonts[glyphs[i].font].face) && 
glyphs[i-1].font==glyphs[i].font && glyphs[i-1].size==glyphs[i].size) {
				// Note: glyphs[i-1] may point beyond start of passed glyphs array,
				// but it's only a section of a larger string, so this unchecked i-1 
is fine
			 
FT_Get_Kerning(TL_Globals.fonts[glyphs[i].font].face,glyphs[i-1].glyph,glyphs[i].glyph,FT_KERNING_UNFITTED,&kerning);
				width+=kerning.x;
			}
		}

	}

	return width;
}

Am I doing something obviously wrong in this snippet? Was there an 
interface change in freetype that I should be aware of?

Regards,
Gregor
Ruslan Nikolaev | 2 Jun 2013 07:38
Picon
Favicon

[ft] Question about hinting and direct rendering

I have a question regarding hinting (e.g., using TTF hinting rather than auto-hinting) and direct rendering. It seems that FT_Outline_Render can be used for direct rendering but will it actually use TTF hinting or I should use FT_Render_Glyph for that (i.e., no direct rendering)?

Also, I am confused about FT_Load_Glyph which loads a glyph to a slot. But a slot FT_GlyphSlotRec contains bitmap, does it mean that bitmap is already prepared by doing Load_Glyph? If so, how to avoid it for direct rendering?

Ruslan
_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype
Werner LEMBERG | 1 Jun 2013 06:44
Picon

Re: [ft] Query Regarding regional language display


Hello Gowree!

> I am trying to use freetype font library to display telugu language
> using ttf font file.

Don't do that.  For Indic scripts, you *must* use a higher-level
library which handles all the intricacies of character reordering,
glyph substitution, ligature formation, and glyph positioning.

I suggest harfbuzz or ICU.

    Werner
Gowree | 31 May 2013 11:53

[ft] Query Regarding regional language display

Hi,

 

                I am Gowree Sankara Rao. I am trying to use freetype font library to display telugu language using ttf font file. when I am trying to display composite characters (shree-> sha+ZWJ+ra+ee), There all individual characters displaying properly. But composite characters not displaying properly. It’s looking like overlapping. Can you please suggest me, how to handle these kind of composite characters using freetype font library. I have seen that composite characters in ttf file with some glyph index value. But there is no Unicode value for that to fetch directly so, just I want to know how can we handle that kind of characters.  

 

 

Thanx & Regards

Gowree sankara Rao Kurmana

Evolute Systems (p) Ltd.

Cambridge Road

Bangalore-08

Contact No: +918088909295

Gowree.s <at> evolute-sys.com

 

_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype
Werner LEMBERG | 29 May 2013 19:50
Picon

[ft] FreeType now supports color emojis


Behdad Esfahbod (on behalf of Google) contributed support for color
embedded bitmaps (eg. color emoji).

  https://color-emoji.googlecode.com/git/specification/v1.html

Here's a link to Google's blog entry:

  http://google-opensource.blogspot.de/2013/05/open-standard-color-font-fun-for.html

Have fun!

    Werner
awiederman | 16 May 2013 22:10
Favicon

[ft] True Type Collection (TTC) shared glyph tables


If I use a True Type Collection (TTC) font file when initializing my FreeType
Face, is there anything special I need to do to render a character that is
part of the shared table in the TTC (but not part of the individual TTF)?

At the moment FT_Get_Char_Index is returning 0 for the CJK Ideograph at
U+7380, and the error symbol is being used.  However, if I open this font
file in Windows' Character Map program it shows that this character is part
of the font.  Additionally, another program I installed called Typograf will
show that this character exists in the font.  I've tested a few other font
programs (like FontForge, Font Creator, and dp4 Font Viewer) and none of
these programs recognize that this character exists in the font, though.  So
I am led to believe that this character is part of the shared glyph table,
and only some of these programs are set up to look there.

Is there a way for me to verify that this character actually is part of the
shared TTC table?  Additionally, is there a way for me to access it using
FreeType if it does indeed exist in the shared table?  Should this be
happening automatically, or is there an error with how I'm setting up the
FreeType Face?

Any insight into TTC font files or this specific issue would be appreciated. 
Thanks!
--

-- 
View this message in context: http://old.nabble.com/True-Type-Collection-%28TTC%29-shared-glyph-tables-tp35405718p35405718.html
Sent from the Freetype - User mailing list archive at Nabble.com.
awiederman | 16 May 2013 22:09
Favicon

[ft] True Type Collection (TTC) shared glyph tables


If I use a True Type Collection (TTC) font file when initializing my FreeType
Face, is there anything special I need to do to render a character that is
part of the shared table in the TTC (but not part of the individual TTF)?

At the moment FT_Get_Char_Index is returning 0 for the CJK Ideograph at
U+7380, and the error symbol is being used.  However, if I open this font
file in Windows' Character Map program it shows that this character is part
of the font.  Additionally, another program I installed called Typograf will
show that this character exists in the font.  I've tested a few other font
programs (like FontForge, Font Creator, and dp4 Font Viewer) and none of
these programs recognize that this character exists in the font, though.  So
I am led to believe that this character is part of the shared glyph table,
and only some of these programs are set up to look there.

Is there a way for me to verify that this character actually is part of the
shared TTC table?  Additionally, is there a way for me to access it using
FreeType if it does indeed exist in the shared table?  Should this be
happening automatically, or is there an error with how I'm setting up the
FreeType Face?

Any insight into TTC font files or this specific issue would be appreciated. 
Thanks!
--

-- 
View this message in context: http://old.nabble.com/True-Type-Collection-%28TTC%29-shared-glyph-tables-tp35405714p35405714.html
Sent from the Freetype - User mailing list archive at Nabble.com.
awiederman | 16 May 2013 22:03
Favicon

[ft] True Type Collection (TTC) shared glyph tables


If I use a True Type Collection (TTC) font file when initializing my FreeType
Face, is there anything special I need to do to render a character that is
part of the shared table in the TTC (but not part of the individual TTF)?

At the moment FT_Get_Char_Index is returning 0 for the CJK Ideograph at
U+7380, and the error symbol is being used.  However, if I open this font
file in Windows' Character Map program it shows that this character is part
of the font.  Additionally, another program I installed called Typograf will
show that this character exists in the font.  I've tested a few other font
programs (like FontForge, Font Creator, and dp4 Font Viewer) and none of
these programs recognize that this character exists in the font, though.  So
I am led to believe that this character is part of the shared glyph table,
and only some of these programs are set up to look there.

Is there a way for me to verify that this character actually is part of the
shared TTC table?  Additionally, is there a way for me to access it using
FreeType if it does indeed exist in the shared table?  Should this be
happening automatically, or is there an error with how I'm setting up the
FreeType Face?

Any insight into TTC font files or this specific issue would be appreciated. 
Thanks!
--

-- 
View this message in context: http://old.nabble.com/True-Type-Collection-%28TTC%29-shared-glyph-tables-tp35405699p35405699.html
Sent from the Freetype - User mailing list archive at Nabble.com.

Gmane