diff options
author | Werner Lemberg <wl@gnu.org> | 2021-06-08 09:00:39 +0200 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2021-06-08 09:00:39 +0200 |
commit | 36ee71714f5f84876cd3e9b479dbbd72a5124412 (patch) | |
tree | 81f149e873800806114a8366dfb0127a163bfc2f /include/freetype/freetype.h | |
parent | 2b1d5562694ef29f1819e1a5046226076a0deede (diff) | |
download | freetype2-36ee71714f5f84876cd3e9b479dbbd72a5124412.tar.gz |
[sdf] Formatting and improved comments.
Diffstat (limited to 'include/freetype/freetype.h')
-rw-r--r-- | include/freetype/freetype.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index ebb129f71..a66d45a27 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -3306,8 +3306,9 @@ FT_BEGIN_HEADER * bitmaps. Each pixel in a SDF bitmap contains information about the * nearest edge of the glyph outline. The distances are calculated * from the center of the pixel and are positive if they are filled by - * the outline (i.e., inside the outline) and negative otherwise. Check - * the note below on how to convert the output values to usable data. + * the outline (i.e., inside the outline) and negative otherwise. + * Check the note below on how to convert the output values to usable + * data. * * @note: * The selected render mode only affects vector glyphs of a font. @@ -3315,30 +3316,31 @@ FT_BEGIN_HEADER * @FT_PIXEL_MODE_MONO. You can use @FT_Bitmap_Convert to transform them * into 8-bit pixmaps. * - * For @FT_RENDER_MODE_SDF output bitmap buffer contains normalized - * distance values that are packed into unsigned 8-bit buffer. To get - * pixel values in floating point representation use the following - * conversion: + * For @FT_RENDER_MODE_SDF the output bitmap buffer contains normalized + * distances that are packed into unsigned 8-bit values. To get pixel + * values in floating point representation use the following pseudo-C + * code for the conversion. * * ``` - * <load glyph and render using @FT_RENDER_MODE_SDF, then use the - * output buffer as follows> + * // Load glyph and render using FT_RENDER_MODE_SDF, + * // then use the output buffer as follows. * * ... - * FT_Byte buffer = glyph->bitmap->buffer; + * FT_Byte buffer = glyph->bitmap->buffer; + * * * for pixel in buffer * { - * <`sd` is the signed distance and spread is the current `spread`, - * the default spread is 2 and can be changed> + * // `sd` is the signed distance and `spread` is the current spread; + * // the default spread is 2 and can be changed. * - * float sd = (float)pixel - 128.0f; + * float sd = (float)pixel - 128.0f; * - * <convert the to pixel values> * + * // Convert to pixel values. * sd = ( sd / 128.0f ) * spread; * - * <store `sd` in a buffer or use as required> + * // Store `sd` in a buffer or use as required. * } * * ``` |