Skip to content

Commit

Permalink
Update font-rs dep
Browse files Browse the repository at this point in the history
  • Loading branch information
marceline-cramer authored and katyo committed Apr 5, 2024
1 parent 1f3f725 commit 5e62bcf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ optional = true

[dependencies.font-rs]
package = "font"
version = "0.15"
version = "0.29"
optional = true

[dependencies.freetype-rs]
Expand Down
10 changes: 5 additions & 5 deletions src/interop/font.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{EdgeColor, EdgeHolder, FontExt, Point2, Shape};
use font_rs as font;
use font_rs::{self as font, glyph::Segment};
use std::{
cell::RefCell,
sync::{Mutex, RwLock},
Expand Down Expand Up @@ -30,7 +30,7 @@ impl FontExt for RwLock<font::Font> {
}

fn glyph_shape(font: &mut font::Font, glyph: char) -> Option<Shape> {
let glyph = font.draw(glyph).ok()??;
let glyph = font.glyph(glyph).ok()??;
let mut shape = Shape::default();

for contour in glyph.iter() {
Expand All @@ -40,7 +40,7 @@ fn glyph_shape(font: &mut font::Font, glyph: char) -> Option<Shape> {

for segment in contour.iter() {
match *segment {
font::Segment::Linear(font::Offset(x, y)) => {
Segment::Linear(font::Offset(x, y)) => {
let point = Point2::new(x as f64, y as f64);
last_contour.add_edge(&EdgeHolder::new_linear(
last_point,
Expand All @@ -49,7 +49,7 @@ fn glyph_shape(font: &mut font::Font, glyph: char) -> Option<Shape> {
));
last_point = point;
}
font::Segment::Quadratic(font::Offset(cx, cy), font::Offset(x, y)) => {
Segment::Quadratic(font::Offset(cx, cy), font::Offset(x, y)) => {
let cpoint = Point2::new(cx as f64, cy as f64);
let point = Point2::new(x as f64, y as f64);
last_contour.add_edge(&EdgeHolder::new_quadratic(
Expand All @@ -60,7 +60,7 @@ fn glyph_shape(font: &mut font::Font, glyph: char) -> Option<Shape> {
));
last_point = point;
}
font::Segment::Cubic(
Segment::Cubic(
font::Offset(c1x, c1y),
font::Offset(c2x, c2y),
font::Offset(x, y),
Expand Down

0 comments on commit 5e62bcf

Please sign in to comment.