Skip to content

Commit

Permalink
Take q32 from typeface
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanUkhov committed Dec 21, 2024
1 parent e5dae7c commit 6c3f5bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "postscript"
version = "0.18.3"
version = "0.18.4"
edition = "2021"
license = "Apache-2.0/MIT"
authors = ["Ivan Ukhov <ivan.ukhov@gmail.com>"]
Expand All @@ -14,7 +14,7 @@ keywords = ["font", "postscript", "typeface", "typography"]
exclude = ["tests/fixtures/*"]

[dependencies]
typeface = "0.4.2"
typeface = "0.4.3"

[dev-dependencies]
random = "0.14"
6 changes: 3 additions & 3 deletions src/type2/number.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::Result;
use typeface::q32;

const SCALE: f32 = (1 << 16) as f32;
use crate::Result;

pub fn read<T: crate::tape::Read>(tape: &mut T) -> Result<f32> {
let first = tape.take::<u8>()?;
Expand All @@ -9,7 +9,7 @@ pub fn read<T: crate::tape::Read>(tape: &mut T) -> Result<f32> {
0xf7..=0xfa => ((first as i32 - 247) * 256 + tape.take::<u8>()? as i32 + 108) as f32,
0xfb..=0xfe => (-(first as i32 - 251) * 256 - tape.take::<u8>()? as i32 - 108) as f32,
0x1c => tape.take::<u16>()? as i16 as i32 as f32,
0xff => (tape.take::<i32>()? as f32) / SCALE,
0xff => tape.take::<q32>()?.into(),
_ => raise!("found a malformed number"),
})
}
Expand Down

0 comments on commit 6c3f5bb

Please sign in to comment.