[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freetype] Some newbie questions
From: |
David Turner |
Subject: |
Re: [Freetype] Some newbie questions |
Date: |
Tue, 12 Mar 2002 17:02:58 +0100 |
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