* include/freetype/ftsynth.h, src/basae/ftsynth.c: Move

FT_GlyphSlot_Own_Bitmap to...
* include/freetype/ftbitmap.h, src/base/ftbitmap.c: These files.

* docs/CHANGES: Document it.
This commit is contained in:
Werner Lemberg 2008-12-17 10:50:31 +00:00
parent 00bcd34ae6
commit c8c4cc837c
6 changed files with 83 additions and 40 deletions

View File

@ -1,3 +1,11 @@
2008-12-17 Werner Lemberg <wl@gnu.org>
* include/freetype/ftsynth.h, src/basae/ftsynth.c: Move
FT_GlyphSlot_Own_Bitmap to...
* include/freetype/ftbitmap.h, src/base/ftbitmap.c: These files.
* docs/CHANGES: Document it.
2008-12-10 Werner Lemberg <wl@gnu.org>
Generalize the concept of `tricky' fonts by introducing

View File

@ -51,6 +51,11 @@ CHANGES BETWEEN 2.3.8 and 2.3.7
. Tricky TrueType fonts always use the bytecode interpreter,
either the patented or unpatented version.
- The function `FT_GlyphSlot_Own_Bitmap' has been moved from
FT_SYNTHESIS_H to FT_BITMAP_H; it is now part of the `official'
API. (The functions in FT_SYNTHESIS_H are still subject to
change, however.)
======================================================================

View File

@ -2,10 +2,9 @@
/* */
/* ftbitmap.h */
/* */
/* FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */
/* bitmaps into 8bpp format (specification). */
/* FreeType utility functions for bitmaps (specification). */
/* */
/* Copyright 2004, 2005, 2006 by */
/* Copyright 2004, 2005, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -121,7 +120,7 @@ FT_BEGIN_HEADER
/* or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */
/* */
/* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */
/* you should call `FT_GlyphSlot_Own_Bitmap' on the slot first. */
/* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */
/* */
FT_EXPORT( FT_Error )
FT_Bitmap_Embolden( FT_Library library,
@ -170,6 +169,28 @@ FT_BEGIN_HEADER
FT_Int alignment );
/*************************************************************************/
/* */
/* <Function> */
/* FT_GlyphSlot_Own_Bitmap */
/* */
/* <Description> */
/* Make sure that a glyph slot owns `slot->bitmap'. */
/* */
/* <Input> */
/* slot :: The glyph slot. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* This function is to be used in combination with */
/* @FT_Bitmap_Embolden. */
/* */
FT_EXPORT( FT_Error )
FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );
/*************************************************************************/
/* */
/* <Function> */

View File

@ -5,7 +5,7 @@
/* FreeType synthesizing code for emboldening and slanting */
/* (specification). */
/* */
/* Copyright 2000-2001, 2003, 2006 by */
/* Copyright 2000-2001, 2003, 2006, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -23,7 +23,7 @@
/*************************************************************************/
/*************************************************************************/
/********* *********/
/********* WARNING, THIS IS ALPHA CODE, THIS API *********/
/********* WARNING, THIS IS ALPHA CODE! THIS API *********/
/********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/
/********* FREETYPE DEVELOPMENT TEAM *********/
/********* *********/
@ -34,6 +34,13 @@
/*************************************************************************/
/* Main reason for not lifting the functions in this module to a */
/* `standard' API is that the used parameters for emboldening and */
/* slanting are not configurable. Consider the functions as a */
/* code resource which should be copied into the application and */
/* adapted to the particular needs. */
#ifndef __FTSYNTH_H__
#define __FTSYNTH_H__
@ -50,20 +57,20 @@
FT_BEGIN_HEADER
/* Make sure slot owns slot->bitmap. */
FT_EXPORT( FT_Error )
FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot );
/* Do not use this function directly! Copy the code to */
/* your application and modify it to suit your need. */
/* Embolden a glyph by a `reasonable' value (which is highly a matter of */
/* taste). This function is actually a convenience function, providing */
/* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */
/* */
/* For emboldened outlines the metrics are estimates only; if you need */
/* precise values you should call @FT_Outline_Get_CBox. */
FT_EXPORT( void )
FT_GlyphSlot_Embolden( FT_GlyphSlot slot );
/* Slant an outline glyph to the right by about 12 degrees. */
FT_EXPORT( void )
FT_GlyphSlot_Oblique( FT_GlyphSlot slot );
/* */
/* */
FT_END_HEADER

View File

@ -2,10 +2,9 @@
/* */
/* ftbitmap.c */
/* */
/* FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */
/* bitmaps into 8bpp format (body). */
/* FreeType utility functions for bitmaps (body). */
/* */
/* Copyright 2004, 2005, 2006, 2007 by */
/* Copyright 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -19,6 +18,7 @@
#include <ft2build.h>
#include FT_BITMAP_H
#include FT_IMAGE_H
#include FT_INTERNAL_OBJECTS_H
@ -603,6 +603,31 @@
}
/* documentation is in ftbitmap.h */
FT_EXPORT_DEF( FT_Error )
FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot )
{
if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP &&
!( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
{
FT_Bitmap bitmap;
FT_Error error;
FT_Bitmap_New( &bitmap );
error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap );
if ( error )
return error;
slot->bitmap = bitmap;
slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
}
return FT_Err_Ok;
}
/* documentation is in ftbitmap.h */
FT_EXPORT_DEF( FT_Error )

View File

@ -68,29 +68,6 @@
/*************************************************************************/
FT_EXPORT_DEF( FT_Error )
FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot )
{
if ( slot && slot->format == FT_GLYPH_FORMAT_BITMAP &&
!( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) )
{
FT_Bitmap bitmap;
FT_Error error;
FT_Bitmap_New( &bitmap );
error = FT_Bitmap_Copy( slot->library, &slot->bitmap, &bitmap );
if ( error )
return error;
slot->bitmap = bitmap;
slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
}
return FT_Err_Ok;
}
/* documentation is in ftsynth.h */
FT_EXPORT_DEF( void )