Werner LEMBERG | 1 Sep 2010 06:59
Picon

Re: [ft] reading glyph bitmap


> Starting for x and y offsets of 0 this as expected reads in the
> first vertical line in the bitmap into the first scanline and
> orients the glyph horizontally.  Every time I've tried to scan the
> bitmap from top left down or from bottom left up I've failed.  Can
> anybody explain why?  Also how do you flip the glyph, I ask because
> rotation is not enough to fix the glyph read in the way I've been
> able to so far.

You should study how the tutorial examples work, in particular
`example1.c'.

  http://freetype.freedesktop.org/freetype2/docs/tutorial/

    Werner
Minhaj Ahmed | 1 Sep 2010 19:12

RE: [ft] reading glyph bitmap

Here is the sample code which fails to retrieve the bitmap glyph properly, I see all white space with a 
...................

at the end for number 3 for example..yet example1.c here 
 http://freetype.freedesktop.org/freetype2/docs/tutorial/
works well with letters/numbers oriented as provided in the original email below...
/////////////////////////////////////////////////////////
//
void PrintLetter(
                  unsigned char *my_buf, //this buffer is face->glyph->bitmap->buffer
                  FT_Bitmap *bmp //same bitmap struct to which the buffer above belongs
)
{
        FT_Int i, j, p;
        FT_Int x_max = bmp->pitch;
        FT_Int y_max = bmp->rows;

        //
        // i each time should equal the first pixel in each row and 
        // should move upward every iteration
        // j would print one by one each byte in a given row
        //
        for (i = (y_max-1)*x_max, p = 0; p < y_max ; i-=x_max, p++ )
        {
                for ( j = i; j < x_max; j++)
                {
                        putchar(my_buf[j] == 0 ? ' ' : my_buf[j] < 128 ? '-' : '.');
                }
                putchar('\n');
        }
(Continue reading)

Minhaj Ahmed | 2 Sep 2010 16:51

RE: [ft] reading glyph bitmap

Corrected and functional code attached...I guess I was distracted by other problems in the code too much 
/////////////////////////////////////////////////////////
//
void PrintLetter(unsigned char *my_buf, FT_Bitmap *bmp)
{
        FT_Int i, j, p, q;
        FT_Int x_max = bmp->pitch;
        FT_Int y_max = bmp->rows;

       printf("In %s\n", __FUNCTION__);

        for (i = 0, p = 0; p < y_max ; i+=x_max, p++ )
        {
                for ( j = i, q=0; q < x_max; q++, j++)
                {
                        putchar(my_buf[j] == 0 ? ' ' : my_buf[j] < 128 ? '-' : '.');
                }
                putchar('\n');
        }
}

________________________________________
From: Minhaj Ahmed
Sent: Wednesday, September 01, 2010 12:12 PM
To: freetype <at> nongnu.org
Cc: Werner LEMBERG
Subject: RE: [ft] reading glyph bitmap

Here is the sample code which fails to retrieve the bitmap glyph properly, I see all white space with a
...................
(Continue reading)

Werner LEMBERG | 6 Sep 2010 14:34
Picon

Re: [ft] reading glyph bitmap

> Corrected and functional code attached... [...]

Does that mean it now works for you?

    Werner
Iñaki Castillo Arteta | 6 Sep 2010 15:39
Favicon

[ft] Cache management tutorial

Hi.

Is there any specific cache management tutorial out there?

 

By the way, is the cache manager *officialy* supported?

 

Regards.

Inaki.

 

 

 

 

 

_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype
Werner LEMBERG | 6 Sep 2010 16:03
Picon

Re: [ft] Cache management tutorial


> Is there any specific cache management tutorial out there?

No, sorry.  You have to study the demo programs like ftview.

> By the way, is the cache manager *officialy* supported?

Again no.  Main reason is not the lack of maturity of code but my lack
of understanding it...

    Werner
Minhaj Ahmed | 7 Sep 2010 04:13

RE: [ft] reading glyph bitmap

Yes!

________________________________________
From: Werner LEMBERG [wl <at> gnu.org]
Sent: Monday, September 06, 2010 7:34 AM
To: Minhaj Ahmed
Cc: freetype <at> nongnu.org
Subject: Re: [ft] reading glyph bitmap

> Corrected and functional code attached... [...]

Does that mean it now works for you?

    Werner
Matthew Tippett | 7 Sep 2010 18:30
Picon

[ft] Compressing CJK Fonts effectively

Hi,

I am working on an embedded project which requires CJK truetype fonts.  
Since it is an embedded system, I want to save as much disk space as 
possible.

The fonts we are using seem to compress to about 70% of their original 
size - which could save around 13 MB on the ROM image.

I noticed the post in 2002 from David Turner when he completed the gzip 
support talking about not wanting to encourage stupid choices (like 
gzip-compressed truetype fonts).

What is the current best practice for managing large CJK fonts in a 
storage efficient manner?

Matthew
Michiel Kamermans | 7 Sep 2010 19:27
Favicon

Re: [ft] Compressing CJK Fonts effectively

Matthew Tippett wrote:
I am working on an embedded project which requires CJK truetype fonts.  Since it is an embedded system, I want to save as much disk space as possible.  The fonts we are using seem to compress to about 70% of their original size - which could save around 13 MB on the ROM image.  I noticed the post in 2002 from David Turner when he completed the gzip support talking about not wanting to encourage stupid choices (like gzip-compressed truetype fonts).  What is the current best practice for managing large CJK fonts in a storage efficient manner?

First check if those fonts exist as OpenType with PostScript Type 2 outlines (CFF). If so, done: use those, that's about as small as the font's going to get, because CFF glyphs are defined in terms of both normal vector instructions as well as glyph subroutines, so shared features between glyphs (and in CJK fonts that can be tens of thousands of features) can be stored as subroutines and remove a bucketload of bytes from the filesize.

If they don't exist as OT(CFF), then you can try to run your font through Adobe's "tx" tool, which is freely available as part of the Font Developer Kit (http://www.adobe.com/devnet/opentype/afdko/). You will lose any hinting that's in the truetype font, but the FDK also comes with autohinter that is pretty much as good as hinting's going to get. Of course, this may also be illegal for the font you're using, so make sure you have the right to create derivatives before you go down that road.

- Mike "Pomax" Kamermans
nihongoresources.com


_______________________________________________
Freetype mailing list
Freetype <at> nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype
suzuki toshiya | 7 Sep 2010 20:38
Picon

Re: [ft] Compressing CJK Fonts effectively

It's interesting theme for CJK people, but difficult
to give quick answer.

The meaning of "embedded system" is too broad to guess
the system limitation, in comparison with desktop,
laptop, netbook or OLPC, please describe more :-)

# small ROM but large RAM?
# consuming CPU is better than consuming ROM/RAM?
# speed of rendering?
# etc etc

Recent generic lossless compressing technologies,
like rzip, would show better compression result,
but will consume more memory/CPU powers.

--

In addition, you want to compress TrueType losslessly?
Or, you don't mind to loss some informations in
TrueType (and invent new TrueType-incompatible font
format)? For example, Agfa MicroType has a technology
called MicroType, to compress TrueType fonts by
restricting the rendering system and removing some
non-essential info for the system. The technology is
adapted by ISO MPEG-4 and Microsoft's embedded OpenType
and it seems that recent Windows Mobile uses it for
bundled CJK fonts. However, the technology is patented,
FreeType2 cannot support it until its expiration, or
change of the license.

W3C seems to work for new font format for web documents
(so the file size reduction would be important theme,
although memory/CPU consumation would not be so critical),
there is a possibility that you can find some interesting
technology.

Matthew Tippett wrote (2010/09/08 1:30):
> Hi,
> 
> I am working on an embedded project which requires CJK truetype fonts.  
> Since it is an embedded system, I want to save as much disk space as 
> possible.
> 
> The fonts we are using seem to compress to about 70% of their original 
> size - which could save around 13 MB on the ROM image.
> 
> I noticed the post in 2002 from David Turner when he completed the gzip 
> support talking about not wanting to encourage stupid choices (like 
> gzip-compressed truetype fonts).

> What is the current best practice for managing large CJK fonts in a 
> storage efficient manner?
> 
> Matthew
> 
> _______________________________________________
> Freetype mailing list
> Freetype <at> nongnu.org
> http://lists.nongnu.org/mailman/listinfo/freetype

Gmane