From 23a0670b9891535765ebd2e7ac51fb02e1e2b9a8 Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 8 Nov 2000 00:20:25 +0000 Subject: [PATCH] removed the file and corrected files that depended on it. the ftlist.c function definitions are now FT_EXPORT_DEF instead of FT_BASE_DEF --- docs/design/design-5.html | 2 +- docs/ft2faq.html | 134 ++++++++++++++++++++++++++++- include/freetype/internal/ftlist.h | 2 - src/base/ftlist.c | 36 ++++---- src/base/ftobjs.c | 2 +- src/cache/ftcchunk.c | 2 +- src/cache/ftcglyph.c | 2 +- src/cache/ftlru.c | 2 +- 8 files changed, 156 insertions(+), 26 deletions(-) delete mode 100644 include/freetype/internal/ftlist.h diff --git a/docs/design/design-5.html b/docs/design/design-5.html index b85badd8d..42736c5e4 100644 --- a/docs/design/design-5.html +++ b/docs/design/design-5.html @@ -17,7 +17,7 @@
- +
diff --git a/docs/ft2faq.html b/docs/ft2faq.html index 19b3f5ab8..c8a9f853e 100644 --- a/docs/ft2faq.html +++ b/docs/ft2faq.html @@ -102,6 +102,22 @@
  • Other questions
  • + +

    + IV.1 Can I use FreeType to draw text on a pixmap with arbitratry depth ? +

    + +

    No directly, as FreeType is a font library, not a general purpose + graphics library or text rendering service. However, note that the + anti-aliased renderer allows you to convert a vectorial glyph outline + into a list of "spans" (i.e. horizontal pixel segments with same coverage) + that can be rendered through user-provided callbacks.

    + +

    By providing the appropriate span callback, you can render anti-aliased + text to any kind of surface. You can also use any color or fill + pattern/image if you want to. This process is called + direct rendering. For more information, please read the + documentation contained in the following files:

    + +
      +
    • + <freetype/ftimage.h> contains the definition + of the FT_Raster_Params type used with direct rendering. +

    • + +
    • + <freetype/ftoutln.h> contains the definition + of the FT_Outline_Render function that can be used to + convert vectorial outlines to span lists. +

    • +
    + +

    Here's some code that uses them:

    +
    +     
    +       FT_Raster_Params  params;
    +       FT_Outline        outline;
    +       
    +       .. load vectorial glyph in "outline"
    +       
    +       params.flags      = ft_raster_flag_aa | ft_raster_flag_direct;
    +       params.gray_spans = (FT_Raster_Span_Func)your_own_span_function_here;
    +       params.user       = your_own_data_pointer;
    +       
    +       error = FT_Outline_Render( library, &outline, &params );
    +     
    + +

    Note that direct rendering is not available with monochrome + output, as the current renderer uses a two-pass algorithm to generate + glyphs with correct drop-out control.

    + +
    +
    +

    + IV.2 How can I set the color of text rendered by FreeType ? +

    + +

    Basically, you can't do that, because FreeType is simply a font + library. In general, you'll need to use your favorite graphics library + to draw the FreeType glyphs with the appropriate color.

    + +

    Note that for anti-aliased glyphs, you can "set the color" by using + direct rendering as described in this + answer

    + + +
    + +

    + IV.3 I set the pixel size to 8x8, but the resulting glyphs are larger + (or smaller) than that. Why ?? +

    + +

    A lot of people have a hard time understanding this topic, because + they think of glyphs as fixed-width/height "cells", like those of + fonts used in terminals/consoles. This assumption is simply not valid + with most "modern" font formats, even bitmapped-based ones like + PCF or BDF.

    + +

    Be aware that the character size that is set either through + FT_Set_Char_Size or FT_Set_Pixel_Sizes isn't directly + related to the dimension of the glyph bitmaps generated.

    + +

    Rather, the character size is indeed the size of + an abstract square, called the EM, used by typographers + to design fonts. Scaling two distinct fonts to the same character size, be + it expressed in points or pixels, will generally result in bitmaps with + distinct dimensions !

    + +

    Note that historically, the EM corresponded to the width of a capital + "M" in Latin typefaces. However, later improvements in typography led to + the designs that greatly detract from this rule. Today, it is not possible + to connect the EM size to a specific font "feature" in a reliable way.

    + +
    + +
    +

    + IV.4 How can I compute the bounding box of a given string of text without + loading its glyphs before ? +

    + +

    A lot of people want to be able to compute the size in pixels of a simple + string of text with minimal overhead. For example, that can be useful to + draw centered text within a button.

    + +

    IV.1 Which anti-aliasing algorithm is used by FreeType 2?

    @@ -565,6 +696,7 @@

    We will try to document its design in a later document, though this is not a priority for now.

    +

    IV.2 When will FreeType 2 support OpenType? diff --git a/include/freetype/internal/ftlist.h b/include/freetype/internal/ftlist.h deleted file mode 100644 index 2ae03e43c..000000000 --- a/include/freetype/internal/ftlist.h +++ /dev/null @@ -1,2 +0,0 @@ -#include - diff --git a/src/base/ftlist.c b/src/base/ftlist.c index 6cb384a72..b2688b0af 100644 --- a/src/base/ftlist.c +++ b/src/base/ftlist.c @@ -23,7 +23,7 @@ /*************************************************************************/ -#include +#include #include #include @@ -40,8 +40,8 @@ /* documentation is in ftlist.h */ - FT_BASE_DEF( FT_ListNode ) FT_List_Find( FT_List list, - void* data ) + FT_EXPORT_DEF( FT_ListNode ) FT_List_Find( FT_List list, + void* data ) { FT_ListNode cur; @@ -61,8 +61,8 @@ /* documentation is in ftlist.h */ - FT_BASE_DEF( void ) FT_List_Add( FT_List list, - FT_ListNode node ) + FT_EXPORT_DEF( void ) FT_List_Add( FT_List list, + FT_ListNode node ) { FT_ListNode before = list->tail; @@ -81,8 +81,8 @@ /* documentation is in ftlist.h */ - FT_BASE_DEF( void ) FT_List_Insert( FT_List list, - FT_ListNode node ) + FT_EXPORT_DEF( void ) FT_List_Insert( FT_List list, + FT_ListNode node ) { FT_ListNode after = list->head; @@ -101,8 +101,8 @@ /* documentation is in ftlist.h */ - FT_BASE_DEF( void ) FT_List_Remove( FT_List list, - FT_ListNode node ) + FT_EXPORT_DEF( void ) FT_List_Remove( FT_List list, + FT_ListNode node ) { FT_ListNode before, after; @@ -124,8 +124,8 @@ /* documentation is in ftlist.h */ - FT_BASE_DEF( void ) FT_List_Up( FT_List list, - FT_ListNode node ) + FT_EXPORT_DEF( void ) FT_List_Up( FT_List list, + FT_ListNode node ) { FT_ListNode before, after; @@ -153,9 +153,9 @@ /* documentation is in ftlist.h */ - FT_BASE_DEF( FT_Error ) FT_List_Iterate( FT_List list, - FT_List_Iterator iterator, - void* user ) + FT_EXPORT_DEF( FT_Error ) FT_List_Iterate( FT_List list, + FT_List_Iterator iterator, + void* user ) { FT_ListNode cur = list->head; FT_Error error = FT_Err_Ok; @@ -179,10 +179,10 @@ /* documentation is in ftlist.h */ - FT_BASE_DEF( void ) FT_List_Finalize( FT_List list, - FT_List_Destructor destroy, - FT_Memory memory, - void* user ) + FT_EXPORT_DEF( void ) FT_List_Finalize( FT_List list, + FT_List_Destructor destroy, + FT_Memory memory, + void* user ) { FT_ListNode cur; diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 7bc48eb92..c3cc8d47b 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -16,8 +16,8 @@ /***************************************************************************/ +#include #include -#include #include #include diff --git a/src/cache/ftcchunk.c b/src/cache/ftcchunk.c index a8dec04d3..adea14cb8 100644 --- a/src/cache/ftcchunk.c +++ b/src/cache/ftcchunk.c @@ -17,9 +17,9 @@ #include +#include #include #include -#include #include diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c index bbe2b620c..2a8b06b16 100644 --- a/src/cache/ftcglyph.c +++ b/src/cache/ftcglyph.c @@ -18,8 +18,8 @@ #include #include +#include #include -#include #include diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c index 7a41db6b8..b2480d863 100644 --- a/src/cache/ftlru.c +++ b/src/cache/ftlru.c @@ -17,8 +17,8 @@ #include +#include #include -#include static