freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] Fonts with partial-coverage bitmap strikes


From: Keith Packard
Subject: [ft-devel] Fonts with partial-coverage bitmap strikes
Date: Tue, 30 Oct 2007 22:15:12 -0700

I'd like to be able to know when Freetype will use a strike size for an
FT_Face after the size has been specified. This will let me select
monochrome rendering for any glyphs which don't happen to have bitmaps
in the strike.

Right now, I've coded up a fairly ugly hack which attempts to guess when
Freetype will be using a strike:

    /*
     * Force non-AA drawing when using a bitmap strike that
     * won't be resampled due to non-scaling transform
     */
    if (!unscaled->have_shape &&
        (scaled_font->ft_options.load_flags & FT_LOAD_NO_BITMAP) == 0 &&
        scaled_font->ft_options.base.antialias != CAIRO_ANTIALIAS_NONE &&
        (face->face_flags & FT_FACE_FLAG_FIXED_SIZES))
    {
        int             i;
        FT_Size_Metrics *size_metrics = &face->size->metrics;

        for (i = 0; i < face->num_fixed_sizes; i++)
        {
            FT_Bitmap_Size  *bitmap_size = &face->available_sizes[i];

            if (bitmap_size->x_ppem == size_metrics->x_ppem * 64 &&
                bitmap_size->y_ppem == size_metrics->y_ppem * 64)
            {
                scaled_font->ft_options.base.antialias = CAIRO_ANTIALIAS_NONE;
                break;
            }
        }
    }

I'd much rather just get the strike_index somehow and check for !=
0xffff. Would that be a reasonable API to add?

FT_UInt
FT_Get_Strike_Index (FT_Face face);

return -1 for not using any strike, otherwise the index into the
available_sizes array.

-- 
address@hidden

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]