Skip to content

Commit 0c12196

Browse files
committed
Switch to own memmap fork.
This one doesn't depend on winapi. danburkert/memmap-rs#89
1 parent 378b0df commit 0c12196

File tree

4 files changed

+12
-35
lines changed

4 files changed

+12
-35
lines changed

Cargo.lock

Lines changed: 5 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

usvg/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ svgtypes = "0.5"
3333

3434
# for text to path
3535
harfbuzz_rs = { version = "1.0", optional = true }
36-
memmap = { version = "0.7", optional = true }
36+
memmap2 = { git = "https://github.com/RazrFalcon/memmap2-rs", rev = "49e8c1d", optional = true }
3737
ttf-parser = { version = "0.3.0", optional = true }
3838
unicode-bidi = { version = "0.3", optional = true }
3939
unicode-script = { version = "0.3", optional = true }
4040
unicode-vo = { version = "0.1", optional = true }
4141

4242
[features]
4343
default = ["text"]
44-
text = ["harfbuzz_rs", "memmap", "ttf-parser", "unicode-bidi", "unicode-script", "unicode-vo"]
44+
text = ["harfbuzz_rs", "memmap2", "ttf-parser", "unicode-bidi", "unicode-script", "unicode-vo"]

usvg/src/convert/text/shaper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ fn shape_text_with_font(
274274
// We can't simplify this code because of lifetimes.
275275
let item = db.font(font.id);
276276
let file = std::fs::File::open(&item.path).ok()?;
277-
let mmap = unsafe { memmap::MmapOptions::new().map(&file).ok()? };
277+
let mmap = unsafe { memmap2::MmapOptions::new().map(&file).ok()? };
278278

279279
let hb_face = harfbuzz::Face::from_bytes(&mmap, item.face_index);
280280
let hb_font = harfbuzz::Font::new(hb_face);

usvg/src/fontdb.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl Database {
116116
// We can't simplify this code because of lifetimes.
117117
let item = self.font(id);
118118
let file = fs::File::open(&item.path).ok()?;
119-
let mmap = unsafe { memmap::MmapOptions::new().map(&file).ok()? };
119+
let mmap = unsafe { memmap2::MmapOptions::new().map(&file).ok()? };
120120
let font = ttf_parser::Font::from_data(&mmap, item.face_index).ok()?;
121121

122122
let mut builder = PathBuilder { path: tree::PathData::with_capacity(16) };
@@ -133,7 +133,7 @@ impl Database {
133133
// We can't simplify this code because of lifetimes.
134134
let item = self.font(id);
135135
let file = fs::File::open(&item.path).ok()?;
136-
let mmap = unsafe { memmap::MmapOptions::new().map(&file).ok()? };
136+
let mmap = unsafe { memmap2::MmapOptions::new().map(&file).ok()? };
137137
let font = ttf_parser::Font::from_data(&mmap, item.face_index).ok()?;
138138

139139
font.glyph_index(c).ok()?;
@@ -146,7 +146,7 @@ impl Database {
146146
// We can't simplify this code because of lifetimes.
147147
let item = self.font(id);
148148
let file = fs::File::open(&item.path).ok()?;
149-
let mmap = unsafe { memmap::MmapOptions::new().map(&file).ok()? };
149+
let mmap = unsafe { memmap2::MmapOptions::new().map(&file).ok()? };
150150
let font = ttf_parser::Font::from_data(&mmap, item.face_index).ok()?;
151151

152152
// Some fonts can have `units_per_em` set to zero, which will break out calculations.
@@ -545,7 +545,7 @@ fn load_font(
545545
fonts: &mut Vec<FontItem>,
546546
) -> Result<(), Box<dyn std::error::Error>> {
547547
let file = fs::File::open(path)?;
548-
let mmap = unsafe { memmap::MmapOptions::new().map(&file)? };
548+
let mmap = unsafe { memmap2::MmapOptions::new().map(&file)? };
549549

550550
let n = ttf_parser::fonts_in_collection(&mmap).unwrap_or(1);
551551
for index in 0..n {

0 commit comments

Comments
 (0)