-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move CFF scaler implementation to skrifa
- Loading branch information
Showing
7 changed files
with
307 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//! CFF hinting. | ||
|
||
use read_fonts::{tables::postscript::dict::Blues, types::Fixed}; | ||
|
||
/// Parameters used to generate the stem and counter zones for the hinting | ||
/// algorithm. | ||
#[derive(Clone)] | ||
pub(crate) struct HintParams { | ||
pub blues: Blues, | ||
pub family_blues: Blues, | ||
pub other_blues: Blues, | ||
pub family_other_blues: Blues, | ||
pub blue_scale: Fixed, | ||
pub blue_shift: Fixed, | ||
pub blue_fuzz: Fixed, | ||
pub language_group: i32, | ||
} | ||
|
||
impl Default for HintParams { | ||
fn default() -> Self { | ||
Self { | ||
blues: Blues::default(), | ||
other_blues: Blues::default(), | ||
family_blues: Blues::default(), | ||
family_other_blues: Blues::default(), | ||
// See <https://learn.microsoft.com/en-us/typography/opentype/spec/cff2#table-16-private-dict-operators> | ||
blue_scale: Fixed::from_f64(0.039625), | ||
blue_shift: Fixed::from_i32(7), | ||
blue_fuzz: Fixed::ONE, | ||
language_group: 0, | ||
} | ||
} | ||
} | ||
|
||
/// Hinting state for a PostScript subfont. | ||
/// | ||
/// Note that hinter states depend on the scale, subfont index and | ||
/// variation coordinates of a glyph. They can be retained and reused | ||
/// if those values remain the same. | ||
#[derive(Copy, Clone)] | ||
pub(crate) struct HintState { | ||
// TODO | ||
} | ||
|
||
impl HintState { | ||
pub fn new(_params: &HintParams, _scale: Fixed) -> Self { | ||
Self {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//! Support for scaling CFF outlines. | ||
|
||
// Temporary until new scaler API is done. | ||
#![allow(dead_code)] | ||
|
||
mod hint; | ||
mod scaler; | ||
|
||
pub(crate) use scaler::{Scaler, Subfont}; |
Oops, something went wrong.