Make FontSystem not self-referencing
This commit is contained in:
parent
0548d7ae59
commit
506a4194be
10 changed files with 206 additions and 175 deletions
10
src/cache.rs
10
src/cache.rs
|
|
@ -1,10 +1,12 @@
|
|||
// SPDX-License-Identifier: MIT OR Apache-2.0
|
||||
|
||||
use crate::FontKey;
|
||||
|
||||
/// Key for building a glyph cache
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
pub struct CacheKey {
|
||||
/// Font ID
|
||||
pub font_id: fontdb::ID,
|
||||
/// Font key
|
||||
pub font_key: FontKey,
|
||||
/// Glyph ID
|
||||
pub glyph_id: u16,
|
||||
/// `f32` bits of font size
|
||||
|
|
@ -17,7 +19,7 @@ pub struct CacheKey {
|
|||
|
||||
impl CacheKey {
|
||||
pub fn new(
|
||||
font_id: fontdb::ID,
|
||||
font_key: FontKey,
|
||||
glyph_id: u16,
|
||||
font_size: f32,
|
||||
pos: (f32, f32),
|
||||
|
|
@ -26,7 +28,7 @@ impl CacheKey {
|
|||
let (y, y_bin) = SubpixelBin::new(pos.1);
|
||||
(
|
||||
Self {
|
||||
font_id,
|
||||
font_key,
|
||||
glyph_id,
|
||||
font_size_bits: font_size.to_bits(),
|
||||
x_bin,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue