fix(pkg/freetype): fully correct load flags
These now properly match the FreeType API- compared directly in the unit tests against the values provided by the FreeType header itself. This was ridiculously wrong before, like... wow.pull/9691/head
parent
3cd6939af6
commit
6d65abc489
|
|
@ -252,8 +252,12 @@ pub const RenderMode = enum(c_uint) {
|
||||||
sdf = c.FT_RENDER_MODE_SDF,
|
sdf = c.FT_RENDER_MODE_SDF,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A list of bit field constants for FT_Load_Glyph to indicate what kind of
|
/// A collection of flags for FT_Load_Glyph that indicate
|
||||||
/// operations to perform during glyph loading.
|
/// what kind of operations to perform during glyph loading.
|
||||||
|
///
|
||||||
|
/// Some of these flags are not included in the official FreeType
|
||||||
|
/// documentation, but are nevertheless present and named in the
|
||||||
|
/// header, so the names have been copied from there.
|
||||||
pub const LoadFlags = packed struct(c_int) {
|
pub const LoadFlags = packed struct(c_int) {
|
||||||
no_scale: bool = false,
|
no_scale: bool = false,
|
||||||
no_hinting: bool = false,
|
no_hinting: bool = false,
|
||||||
|
|
@ -263,7 +267,7 @@ pub const LoadFlags = packed struct(c_int) {
|
||||||
force_autohint: bool = false,
|
force_autohint: bool = false,
|
||||||
crop_bitmap: bool = false,
|
crop_bitmap: bool = false,
|
||||||
pedantic: bool = false,
|
pedantic: bool = false,
|
||||||
_padding1: u1 = 0,
|
advance_only: bool = false,
|
||||||
ignore_global_advance_width: bool = false,
|
ignore_global_advance_width: bool = false,
|
||||||
no_recurse: bool = false,
|
no_recurse: bool = false,
|
||||||
ignore_transform: bool = false,
|
ignore_transform: bool = false,
|
||||||
|
|
@ -271,17 +275,13 @@ pub const LoadFlags = packed struct(c_int) {
|
||||||
linear_design: bool = false,
|
linear_design: bool = false,
|
||||||
sbits_only: bool = false,
|
sbits_only: bool = false,
|
||||||
no_autohint: bool = false,
|
no_autohint: bool = false,
|
||||||
target_normal: bool = false,
|
target: Target = .normal,
|
||||||
target_light: bool = false,
|
|
||||||
target_mono: bool = false,
|
|
||||||
target_lcd: bool = false,
|
|
||||||
color: bool = false,
|
color: bool = false,
|
||||||
target_lcd_v: bool = false,
|
|
||||||
compute_metrics: bool = false,
|
compute_metrics: bool = false,
|
||||||
bitmap_metrics_only: bool = false,
|
bitmap_metrics_only: bool = false,
|
||||||
_padding2: u1 = 0,
|
svg_only: bool = false,
|
||||||
no_svg: bool = false,
|
no_svg: bool = false,
|
||||||
_padding3: u6 = 0,
|
_padding: u7 = 0,
|
||||||
|
|
||||||
pub const Target = enum(u4) {
|
pub const Target = enum(u4) {
|
||||||
normal = 0,
|
normal = 0,
|
||||||
|
|
|
||||||
|
|
@ -376,11 +376,15 @@ pub const Face = struct {
|
||||||
// If we're gonna be rendering this glyph in monochrome,
|
// If we're gonna be rendering this glyph in monochrome,
|
||||||
// then we should use the monochrome hinter as well, or
|
// then we should use the monochrome hinter as well, or
|
||||||
// else it won't look very good at all.
|
// else it won't look very good at all.
|
||||||
.target_mono = self.load_flags.monochrome,
|
//
|
||||||
|
// Otherwise if the user asked for light hinting we
|
||||||
// Otherwise we select hinter based on the `light` flag.
|
// use that, otherwise we just use the normal target.
|
||||||
.target_normal = !self.load_flags.light and !self.load_flags.monochrome,
|
.target = if (self.load_flags.monochrome)
|
||||||
.target_light = self.load_flags.light and !self.load_flags.monochrome,
|
.mono
|
||||||
|
else if (self.load_flags.light)
|
||||||
|
.light
|
||||||
|
else
|
||||||
|
.normal,
|
||||||
|
|
||||||
// NO_SVG set to true because we don't currently support rendering
|
// NO_SVG set to true because we don't currently support rendering
|
||||||
// SVG glyphs under FreeType, since that requires bundling another
|
// SVG glyphs under FreeType, since that requires bundling another
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue