freetype
[Top][All Lists]
Advanced

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

RE: [Freetype] Some newbie questions


From: Nitzan Shaked
Subject: RE: [Freetype] Some newbie questions
Date: Tue, 12 Mar 2002 20:15:39 +0200

Hello David, all:

Two follow-ups, with your permission:

1) To "dramitically reduce memory consumption", I'm guessing that I would
have to write a font loader module which will NOT store any dynamic data,
but rather re-parse everything whenever it is needed. Thus, the size of a
"Face" object can be almost 0, and all the dynamic data I would need is the
cache and the raster pool. I don't even have to have a bitmap object,
because I can use the span-callback to draw directly to the buffer. So
basically, what's involved here is reducing the size of a face object to as
close as zero as possible.

2) According to my understanding, the linear metrics are NOT sampled to the
pixel grid, as opposed to the hinted metrics. Are they transformed, though?
And also, if they're not hinted, then they might be incorrect! Then hinter
may ENLARGE the actualy metrics! Otherwise, I'm sorry to say I don't
understand the point.

        Nitzan


-----Original Message-----
From: David Turner [mailto:address@hidden 
Sent: Tuesday, March 12, 2002 18:03
To: address@hidden
Subject: Re: [Freetype] Some newbie questions


Hello,

Nitzan Shaked a écrit :
> 
> Hi all
> 
> I read every piece of documentation I could find on freetype.org, and 
> still have some open questions. Please pardon me grouping them like 
> this is one message. Here goes:
> 
> * Just for terminology's sake: a "character" is a logical entity, 
> representing NOT the picture but the meaning. A "glyph" is a picture 
> which can represent one (but sometimes more) character. A "script" is 
> a written language, with all it's characters and some conventions 
> (like layout direction etc). Correct?
>
that's correct for "character" and "glyph". However, a "script" is a
collection of characters that can be used to write one or more related
"languages" plus some eventual conventions (like layout direction).

A few examples are:

  the "latin script" corresponds to all the letters used to write
  english, french, german, spanish but also swedish, finnish, etc..

  the "arabic" script is used to write several languages of the
  Arab world

See also this page on the web:

  http://www.paratype.com/library/languag/language.html


 
> * Can someone tell me FT2's peak RAM consumption for one open font 
> (say Courier or TimesNewRoman) ? I'm thinking about porting FT2 to a 
> *very* memory-tight embedded environment.
>
You could determine this yourself. Do the following:

  - toggle FT_DEBUG_MEMORY to "#define" in
include/freetype/config/ftoption.h

  - re-compile the library, then compile the test programs

  - define the environment variable "FT_DEBUG_MEMORY" to 1

  - run any of the test program. You'll see a dump describing
    leaked memory blocks (if any), as well as total allocations
    and maximum footprint..

note that this works with _any_ program linked to FreeType, not just the
demo programs..

Finally, it's possible to reduce the memory needed by FreeType to process
TrueType or Postscript fonts rather importantly, but this is by no means
trivial since it requires a good understanding of the font specifications
and of the engine itself.. You should already know that, by the way, since
I've already answered this question to one of your employees who contacted
me privately..


> * What are "glyph->bitmap_left" and "glyph->bitmap_top" ? Are they the 
> offset (in pixels or 26.6 pixels) from current pen position where I 
> should draw the bitmap? Are they put there by FT_Render_Glyph()? If 
> so, does it mean the bitmap is the size of the bbox and that 
> bitmap_left and bitmap_top are actually (xmin>>6, ymin>>6) ?
>
they correspond to the distance of the top-left corner of the bitmap from
the pen position. expressed in integer pixels, with y > 0 for the upper
direction. It is _not_ (xmin>>6,ymin>>6)

Yes, it is set by FT_Load_Glyph or FT_Render_Glyph. Use (bitmap->width and
bitmap->rows to access the glyph bitmap's dimensions in pixels)..
 
> * It's not mentioned, but I'm guessing the answer is YES: when I 
> access a glyph's metrics (after it has been loaded, scaled and 
> hinted), are these the SCALED HINTED metrics? All of them, or only 
> some?
>
Depends on your loading flags, but if the glyph is hinted, its metrics
should be too. You should always access the linearly scaled metrics through
glyph->linearHoriAdvance and glyph->linearVertAdvance. Read the API
reference for more information..

Best Regards,

- David Turner

_______________________________________________
Freetype mailing list
address@hidden http://www.freetype.org/mailman/listinfo/freetype



reply via email to

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