[ft-devel] supporting coloured bitmaps in FreeType

2012-08-15 Thread Graham Asher
Hi to all FreeTypers after a long silence on my part - too much to do in 
CartoType.


I have a simple proposal that would enable FreeType to support fonts 
which can create coloured glyphs. It is primarily intended for bitmap 
font formats used for emojis, emoticons and the like.


I have an immediate need for this for a client, and will have to use it 
whether or not it becomes part of official FreeType, but it seems like a 
simple and non-disruptive change that would add a small amount of value.


The idea is to add just two modes (for the moment - no need to be 
over-elaborate) to FT_Pixel_Mode, for premultiplied ARGB, and the same 
format using 8-bit indexes into a palette. These modes are convenient 
when creating bitmap fonts from PNG images. Thus FT_Pixel_Mode and its 
associated documentation comment become:


/*/
  
/*   */
  /* 
Enum*/
  /*
FT_Pixel_Mode  */
  
/*   */
  /* 
Description */
  /*An enumeration type used to describe the format of pixels in 
a */
  /*given bitmap.  Note that additional formats may be added in 
the*/
  /*
future.*/
  
/*   */
  /* 
Values  */
  /*FT_PIXEL_MODE_NONE 
::  */
  /*  Value~0 is 
reserved. */
  
/*   */
  /*FT_PIXEL_MODE_MONO 
::  */
  /*  A monochrome bitmap, using 1~bit per pixel.  Note that 
pixels*/
  /*  are stored in most-significant order (MSB), which means 
that */
  /*  the left-most pixel in a byte has value 
128. */
  
/*   */
  /*FT_PIXEL_MODE_GRAY 
::  */
  /*  An 8-bit bitmap, generally used to represent anti-aliased 
glyph  */
  /*  images.  Each pixel is stored in one byte.  Note that the 
number */
  /*  of `gray' levels is stored in the `num_grays' field of 
the   */
  /*  @FT_Bitmap structure (it generally is 
256).  */
  
/*   */
  /*FT_PIXEL_MODE_GRAY2 
:: */
  /*  A 2-bit per pixel bitmap, used to represent 
embedded */
  /*  anti-aliased bitmaps in font files according to the 
OpenType */
  /*  specification.  We haven't found a single font using 
this*/
  /*  format, 
however. */
  
/*   */
  /*FT_PIXEL_MODE_GRAY4 
:: */
  /*  A 4-bit per pixel bitmap, representing embedded 
anti-aliased */
  /*  bitmaps in font files according to the OpenType 
specification.   */
  /*  We haven't found a single font using this format, 
however.   */
  
/*   */
  /*FT_PIXEL_MODE_LCD 
::   */
  /*  An 8-bit bitmap, representing RGB or BGR decimated glyph 
images  */
  /*  used for display on LCD displays; the bitmap is three 
times  */
  /*  wider than the original glyph image.  See 
also   */
  /*  
@FT_RENDER_MODE_LCD. */
  
/*   */
  /*FT_PIXEL_MODE_LCD_V 
:: */
  /*  An 8-bit bitmap, representing RGB or BGR decimated glyph 
images  */
  /*  used for display on rotated LCD displays; the bitmap is 
three*/
  /*  times taller than the original glyph image.  See 
also*/
  /*  
@FT_RENDER_MODE_LCD_V.   */
  
/*   */
*  /*FT_PIXEL_MODE_ARGB_PRE 
::  */
  /*  A 32-bit bitmap containing premultiplied ARGB 
pixels.*/
  
/*   */
  /*FT_PIXEL_MODE_ARGB_PRE_PALETTE 
::  */
  /*  An 8-bit bitmap containing palette indexes. Each 
value   

Re: [ft-devel] supporting coloured bitmaps in FreeType

2012-08-15 Thread Werner LEMBERG

 The idea is to add just two modes (for the moment - no need to be
 over-elaborate) to FT_Pixel_Mode, for premultiplied ARGB, and the
 same format using 8-bit indexes into a palette. These modes are
 convenient when creating bitmap fonts from PNG images.  [...]

This sounds great!  Are you going to implement this?


Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] supporting coloured bitmaps in FreeType

2012-08-15 Thread Behdad Esfahbod
On 08/15/2012 11:10 AM, Werner LEMBERG wrote:
 
 The idea is to add just two modes (for the moment - no need to be
 over-elaborate) to FT_Pixel_Mode, for premultiplied ARGB, and the
 same format using 8-bit indexes into a palette. These modes are
 convenient when creating bitmap fonts from PNG images.  [...]
 
 This sounds great!  Are you going to implement this?

Is there any common font format for these?

b

 Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] supporting coloured bitmaps in FreeType

2012-08-15 Thread Graham Asher
Well, what I'm suggesting is just adding these constants, which is a 5 
minute patch. I'm not allowed to release my client's bitmap font format 
(which I invented) into the wild. It would be nice to have a standard 
coloured-bitmap font format but it would probably not be a good idea for 
me to invent it for obvious reasons.


On 15/08/2012 16:10, Werner LEMBERG wrote:

The idea is to add just two modes (for the moment - no need to be
over-elaborate) to FT_Pixel_Mode, for premultiplied ARGB, and the
same format using 8-bit indexes into a palette. These modes are
convenient when creating bitmap fonts from PNG images.  [...]

This sounds great!  Are you going to implement this?


 Werner



___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] supporting coloured bitmaps in FreeType

2012-08-15 Thread Graham Asher
I have asked my client whether they will consider allowing me to make 
their bitmap font format public-domain so that someone can write a clean 
FreeType driver for it. I have a driver for it but it's not 'clean': it 
depends on a huge amount of other proprietary stuff. We would also need 
a clean implementation of the tool to create the font from PNG images.


It's unlikely that they will say yes, but if you don't ask, you don't get.

Graham


On 15/08/2012 16:10, Werner LEMBERG wrote:

The idea is to add just two modes (for the moment - no need to be
over-elaborate) to FT_Pixel_Mode, for premultiplied ARGB, and the
same format using 8-bit indexes into a palette. These modes are
convenient when creating bitmap fonts from PNG images.  [...]

This sounds great!  Are you going to implement this?


 Werner

___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel




___
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel