Roll Fontations, Skrifa to 0.27
List of changes: https://github.com/googlefonts/fontations/compare/skrifa-v0.26.5...skrifa-v0.27.0 Updated crates: * read-fonts: 0.25.3 => 0.26.0 * skrifa: 0.26.5 => 0.27.0 Crates vetted for "safe-to-deploy", "does-not-implement-crypto", "ub-risk-0" Bug: chromium:40045339 Change-Id: I8b3e59a6f49e8fc158d39639cb935037284e35a7 Cq-Include-Trybots: chromium/try:android-rust-arm32-rel Cq-Include-Trybots: chromium/try:android-rust-arm64-dbg Cq-Include-Trybots: chromium/try:android-rust-arm64-rel Cq-Include-Trybots: chromium/try:linux-rust-x64-dbg Cq-Include-Trybots: chromium/try:linux-rust-x64-rel Cq-Include-Trybots: chromium/try:win-rust-x64-dbg Cq-Include-Trybots: chromium/try:win-rust-x64-rel Disable-Rts: True Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6248957 Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org> Auto-Submit: Dominik Röttsches <drott@chromium.org> Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Cr-Commit-Position: refs/heads/main@{#1419317}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
9d37dab26a
commit
2fb340acd7
content/browser
infra
skia
third_party/rust
chromium_crates_io
Cargo.lockCargo.toml
supply-chain
vendor
read-fonts-0.25.3
read-fonts-0.26.0
.cargo-checksum.json.cargo_vcs_info.jsonCargo.lockCargo.tomlCargo.toml.origLICENSE-APACHELICENSE-MITREADME.md
benches
generated
font.rsgenerated_aat.rsgenerated_ankr.rsgenerated_avar.rsgenerated_base.rsgenerated_bitmap.rsgenerated_cbdt.rsgenerated_cblc.rsgenerated_cff.rsgenerated_cff2.rsgenerated_cmap.rsgenerated_colr.rsgenerated_cpal.rsgenerated_cvar.rsgenerated_ebdt.rsgenerated_eblc.rsgenerated_feat.rsgenerated_fvar.rsgenerated_gasp.rsgenerated_gdef.rsgenerated_glyf.rsgenerated_gpos.rsgenerated_gsub.rsgenerated_gvar.rsgenerated_hdmx.rsgenerated_head.rsgenerated_hhea.rsgenerated_hmtx.rsgenerated_hvar.rsgenerated_ift.rsgenerated_layout.rsgenerated_ltag.rsgenerated_maxp.rsgenerated_meta.rsgenerated_mvar.rsgenerated_name.rsgenerated_os2.rsgenerated_post.rsgenerated_postscript.rsgenerated_sbix.rsgenerated_stat.rsgenerated_svg.rsgenerated_test_conditions.rsgenerated_test_count_all.rsgenerated_test_enum.rsgenerated_test_flags.rsgenerated_test_formats.rsgenerated_test_offsets_arrays.rsgenerated_test_records.rsgenerated_varc.rsgenerated_variations.rsgenerated_vhea.rsgenerated_vmtx.rsgenerated_vorg.rsgenerated_vvar.rs
src
array.rscodegen_test.rscollections.rsfont_data.rslib.rsoffset.rsoffset_array.rsread.rstable_provider.rstable_ref.rstables.rs
collections
int_set
range_set.rstables
aat.rsankr.rsavar.rsbase.rsbitmap.rscbdt.rscblc.rscff.rscff2.rscmap.rscolr.rs
colr
cpal.rscvar.rsebdt.rseblc.rsfeat.rsfvar.rsgasp.rsgdef.rsglyf.rsglyf
gpos.rsgsub.rsgsub
gvar.rshdmx.rshead.rshhea.rshmtx.rshvar.rsift.rsinstance_record.rslayout.rslayout
loca.rsltag.rsmaxp.rsmeta.rsmvar.rsname.rsos2.rspost.rspostscript.rspostscript
sbix.rsstat.rssvg.rsvalue_record.rsvarc.rsvariations.rsvhea.rsvmtx.rsvorg.rsvvar.rstests
traversal.rsskrifa-0.26.5
skrifa-0.27.0
.cargo-checksum.json.cargo_vcs_info.jsonCargo.lockCargo.tomlCargo.toml.origLICENSE-APACHELICENSE-MITREADME.md
generated
scripts
src
attribute.rscharmap.rscollections.rsprovider.rssetting.rsstring.rsvariation.rs
color
font.rsinstance.rslib.rsmetrics.rsoutline
autohint
cff
error.rsglyf
deltas.rs
hint.rshint_reliant.rsmetrics.rsmod.rspath.rspen.rstesting.rsunscaled.rshint
call_stack.rscow_slice.rscvt.rsdefinition.rs
memory.rsmod.rsoutline.rsengine
arith.rscontrol_flow.rscvt.rsdata.rsdefinition.rsdelta.rsdispatch.rsgraphics.rslogical.rsmisc.rsmod.rsoutline.rsround.rsstack.rsstorage.rs
error.rsgraphics.rsinstance.rsmath.rsmod.rsprogram.rsprojection.rsround.rsstorage.rsvalue_stack.rszone.rsread_fonts
skrifa
@ -43,8 +43,8 @@ if (is_android) {
|
||||
]
|
||||
deps = [
|
||||
"//third_party/rust/font_types/v0_8:lib",
|
||||
"//third_party/rust/read_fonts/v0_25:lib",
|
||||
"//third_party/rust/skrifa/v0_26:lib",
|
||||
"//third_party/rust/read_fonts/v0_26:lib",
|
||||
"//third_party/rust/skrifa/v0_27:lib",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -693,7 +693,7 @@ third_party/rust/chromium_crates_io/vendor/rand_chacha-0.3.1 4 1
|
||||
third_party/rust/chromium_crates_io/vendor/rand_core-0.6.4 4 1
|
||||
third_party/rust/chromium_crates_io/vendor/rand_core-0.6.4/src 3 1
|
||||
third_party/rust/chromium_crates_io/vendor/rand_pcg-0.3.1 4 1
|
||||
third_party/rust/chromium_crates_io/vendor/read-fonts-0.25.3/src/tables 3 2
|
||||
third_party/rust/chromium_crates_io/vendor/read-fonts-0.26.0/src/tables 3 2
|
||||
third_party/rust/chromium_crates_io/vendor/regex-1.11.1 1 1
|
||||
third_party/rust/chromium_crates_io/vendor/regex-1.11.1/src 1 1
|
||||
third_party/rust/chromium_crates_io/vendor/regex-1.11.1/tests 7 6
|
||||
|
@ -49,8 +49,8 @@ rust_static_library("bridge_rust_side") {
|
||||
deps = [
|
||||
":path_bridge",
|
||||
"//third_party/rust/font_types/v0_8:lib",
|
||||
"//third_party/rust/read_fonts/v0_25:lib",
|
||||
"//third_party/rust/skrifa/v0_26:lib",
|
||||
"//third_party/rust/read_fonts/v0_26:lib",
|
||||
"//third_party/rust/skrifa/v0_27:lib",
|
||||
]
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [
|
||||
|
4
third_party/rust/chromium_crates_io/Cargo.lock
generated
vendored
4
third_party/rust/chromium_crates_io/Cargo.lock
generated
vendored
@ -1037,7 +1037,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "read-fonts"
|
||||
version = "0.25.3"
|
||||
version = "0.26.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
@ -1198,7 +1198,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "skrifa"
|
||||
version = "0.26.5"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
|
@ -37,12 +37,12 @@ qr_code = "2"
|
||||
quote = "1"
|
||||
rand = "0.8"
|
||||
rand_pcg = "0.3"
|
||||
read-fonts = "0.25"
|
||||
read-fonts = "0.26"
|
||||
regex = "1"
|
||||
rustc-demangle-capi = "0.1"
|
||||
serde = "1"
|
||||
serde_json = "1"
|
||||
skrifa = "0.26.3"
|
||||
skrifa = "0.27"
|
||||
small_ctor = "0.1"
|
||||
static_assertions = "1"
|
||||
strum = "0.25.0"
|
||||
|
@ -2410,6 +2410,12 @@ criteria = ["safe-to-deploy", "does-not-implement-crypto", "ub-risk-0"]
|
||||
delta = "0.23.0 -> 0.23.2"
|
||||
notes = "Some IFT changes, and better compatibility with empty PrivateDict in CFF."
|
||||
|
||||
[[audits.read-fonts]]
|
||||
who = "Dominik Röttsches <drott@chromium.org>"
|
||||
criteria = ["safe-to-deploy", "does-not-implement-crypto", "ub-risk-0"]
|
||||
delta = "0.25.3 -> 0.26.0"
|
||||
notes = "Added min_byte_range() method, expose IndexSubtableList for bitmaps. No new unsafe. Gvar delta API changes."
|
||||
|
||||
[[audits.regex]]
|
||||
who = "danakj@chromium.org"
|
||||
criteria = ["safe-to-run", "does-not-implement-crypto"]
|
||||
@ -3172,6 +3178,12 @@ criteria = ["safe-to-deploy", "does-not-implement-crypto", "ub-risk-0"]
|
||||
delta = "0.26.4 -> 0.26.5"
|
||||
notes = "Contains fixes for hdmx metrics for fonts such as Arimo, Tinos, Market Sans."
|
||||
|
||||
[[audits.skrifa]]
|
||||
who = "Dominik Röttsches <drott@chromium.org>"
|
||||
criteria = ["safe-to-deploy", "does-not-implement-crypto", "ub-risk-0"]
|
||||
delta = "0.26.5 -> 0.27.0"
|
||||
notes = "Mostly a fuzzer fix, rejecting oversized composite outlines."
|
||||
|
||||
[[audits.small_ctor]]
|
||||
who = "danakj@chromium.org"
|
||||
criteria = ["safe-to-run", "does-not-implement-crypto"]
|
||||
|
@ -356,7 +356,7 @@ criteria = ["crypto-safe", "safe-to-run"]
|
||||
[policy."rand_pcg:0.3.1"]
|
||||
criteria = ["crypto-safe", "safe-to-run"]
|
||||
|
||||
[policy."read-fonts:0.25.3"]
|
||||
[policy."read-fonts:0.26.0"]
|
||||
criteria = ["crypto-safe", "safe-to-deploy", "ub-risk-2"]
|
||||
|
||||
[policy."regex-automata:0.4.9"]
|
||||
@ -416,7 +416,7 @@ criteria = []
|
||||
[policy."simd-adler32:0.3.7"]
|
||||
criteria = ["crypto-safe", "safe-to-deploy", "ub-risk-2"]
|
||||
|
||||
[policy."skrifa:0.26.5"]
|
||||
[policy."skrifa:0.27.0"]
|
||||
criteria = ["crypto-safe", "safe-to-deploy", "ub-risk-2"]
|
||||
|
||||
[policy."small_ctor:0.1.2"]
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"git": {
|
||||
"sha1": "4746916dcbef5b8772082b7275bb9480b2ed4d35"
|
||||
},
|
||||
"path_in_vcs": "read-fonts"
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
//! the [hhea (Horizontal Header)](https://docs.microsoft.com/en-us/typography/opentype/spec/hhea) table
|
||||
|
||||
include!("../../generated/generated_hhea.rs");
|
@ -1,173 +0,0 @@
|
||||
//! small utilities used in tests
|
||||
|
||||
use crate::{FontData, Scalar};
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// A convenience type for generating a buffer of big-endian bytes.
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct BeBuffer {
|
||||
data: Vec<u8>,
|
||||
tagged_locations: HashMap<String, usize>,
|
||||
}
|
||||
|
||||
impl BeBuffer {
|
||||
pub fn new() -> Self {
|
||||
Default::default()
|
||||
}
|
||||
|
||||
/// The current length of the buffer in bytes.
|
||||
pub fn len(&self) -> usize {
|
||||
self.data.len()
|
||||
}
|
||||
|
||||
/// Returns `true` if the buffer contains zero bytes.
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.data.is_empty()
|
||||
}
|
||||
|
||||
/// Return a reference to the contents of the buffer
|
||||
pub fn as_slice(&self) -> &[u8] {
|
||||
&self.data
|
||||
}
|
||||
|
||||
/// Write any scalar to this buffer.
|
||||
pub fn push(mut self, item: impl Scalar) -> Self {
|
||||
self.data.extend(item.to_raw().as_ref());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn push_with_tag(mut self, item: impl Scalar, tag: &str) -> Self {
|
||||
self.tagged_locations
|
||||
.insert(tag.to_string(), self.data.len());
|
||||
self.data.extend(item.to_raw().as_ref());
|
||||
self
|
||||
}
|
||||
|
||||
/// Write multiple scalars into the buffer
|
||||
pub fn extend<T: Scalar>(mut self, iter: impl IntoIterator<Item = T>) -> Self {
|
||||
for item in iter {
|
||||
self.data.extend(item.to_raw().as_ref());
|
||||
}
|
||||
self
|
||||
}
|
||||
|
||||
pub fn offset_for(&self, tag: &str) -> usize {
|
||||
// panic on unrecognized tags
|
||||
self.tagged_locations.get(tag).copied().unwrap()
|
||||
}
|
||||
|
||||
fn data_for(&mut self, tag: &str) -> &mut [u8] {
|
||||
let offset = self.offset_for(tag);
|
||||
&mut self.data[offset..]
|
||||
}
|
||||
|
||||
pub fn write_at(&mut self, tag: &str, item: impl Scalar) {
|
||||
let data = self.data_for(tag);
|
||||
let raw = item.to_raw();
|
||||
let new_data: &[u8] = raw.as_ref();
|
||||
|
||||
if data.len() < new_data.len() {
|
||||
panic!("not enough room left in buffer for the requested write.");
|
||||
}
|
||||
|
||||
for (left, right) in data.iter_mut().zip(new_data) {
|
||||
*left = *right
|
||||
}
|
||||
}
|
||||
|
||||
pub fn font_data(&self) -> FontData {
|
||||
FontData::new(&self.data)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Deref for BeBuffer {
|
||||
type Target = [u8];
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.data
|
||||
}
|
||||
}
|
||||
|
||||
/// be_buffer_add!(buffer, value) - Add an item to a be_buffer.
|
||||
///
|
||||
/// Will call the appropriate insertion method on BeBuffer depending on the values format.
|
||||
///
|
||||
/// Values can be one of three types:
|
||||
/// 1. Single numeric value, ie: 10u16
|
||||
/// 2. Array of numeric values, ie: [1u8, 2, 3]
|
||||
/// 3. Tagged value: {10u16, "tag_name"}. This will insert the numeric value
|
||||
/// and attach the provide string tag to the insertion location in the buffer.
|
||||
#[macro_export]
|
||||
macro_rules! be_buffer_add {
|
||||
($b:ident, $v:literal) => {
|
||||
let $b = $b.push($v);
|
||||
};
|
||||
($b:ident, {$v:tt : $tag:literal}) => {
|
||||
let $b = $b.push_with_tag($v, $tag);
|
||||
};
|
||||
($b:ident, [$($v:literal),+]) => {
|
||||
let $b = $b.extend([$($v),*]);
|
||||
};
|
||||
($b:ident, $v:tt) => {
|
||||
let $b = $b.push($v);
|
||||
};
|
||||
}
|
||||
|
||||
/// be_buffer!(val1, ..., valn) - Constructs a BeBuffer from the provided list of values:
|
||||
///
|
||||
/// Values can be one of three types:
|
||||
/// 1. Single numeric value, ie: 10u16
|
||||
/// 2. Array of numeric values, ie: [1u8, 2, 3]
|
||||
/// 3. Tagged value: {10u16, "tag_name"}. This will insert the numeric value
|
||||
/// and attach the provide string tag to the insertion location in the buffer.
|
||||
#[macro_export]
|
||||
macro_rules! be_buffer {
|
||||
( $( $x:tt ),+ ) => {
|
||||
{
|
||||
let builder = BeBuffer::new();
|
||||
$(
|
||||
be_buffer_add!(builder, $x);
|
||||
)*
|
||||
builder
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn be_buffer_macro() {
|
||||
let data: &[u8] = &be_buffer! {
|
||||
1u8,
|
||||
2u16,
|
||||
3u32
|
||||
};
|
||||
|
||||
assert_eq!([1, 0, 2, 0, 0, 0, 3], data);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn be_buffer_macro_array() {
|
||||
let data: &[u8] = &be_buffer! {
|
||||
1u8,
|
||||
[2u8, 3, 4, 5, 6]
|
||||
};
|
||||
|
||||
assert_eq!([1, 2, 3, 4, 5, 6], data);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn be_buffer_macro_tagged() {
|
||||
let builder = be_buffer! {
|
||||
1u8,
|
||||
{2u16: "foo"},
|
||||
{(u32::from(3u16)): "bar"}
|
||||
};
|
||||
let data: &[u8] = &builder;
|
||||
|
||||
assert_eq!([1, 0, 2, 0, 0, 0, 3], data);
|
||||
assert_eq!(builder.offset_for("foo"), 1);
|
||||
assert_eq!(builder.offset_for("bar"), 3);
|
||||
}
|
||||
}
|
6
third_party/rust/chromium_crates_io/vendor/read-fonts-0.26.0/.cargo_vcs_info.json
vendored
Normal file
6
third_party/rust/chromium_crates_io/vendor/read-fonts-0.26.0/.cargo_vcs_info.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"git": {
|
||||
"sha1": "10971dae3a6a7f35841f8c22420bb92da9b8ae0e"
|
||||
},
|
||||
"path_in_vcs": "read-fonts"
|
||||
}
|
738
third_party/rust/chromium_crates_io/vendor/read-fonts-0.26.0/Cargo.lock
generated
vendored
Normal file
738
third_party/rust/chromium_crates_io/vendor/read-fonts-0.26.0/Cargo.lock
generated
vendored
Normal file
@ -0,0 +1,738 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anes"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.16.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck"
|
||||
version = "1.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a"
|
||||
dependencies = [
|
||||
"bytemuck_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck_derive"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "cast"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "ciborium"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e"
|
||||
dependencies = [
|
||||
"ciborium-io",
|
||||
"ciborium-ll",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ciborium-io"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757"
|
||||
|
||||
[[package]]
|
||||
name = "ciborium-ll"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9"
|
||||
dependencies = [
|
||||
"ciborium-io",
|
||||
"half",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7"
|
||||
|
||||
[[package]]
|
||||
name = "core_maths"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3b02505ccb8c50b0aa21ace0fc08c3e53adebd4e58caa18a36152803c7709a3"
|
||||
dependencies = [
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "criterion"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f"
|
||||
dependencies = [
|
||||
"anes",
|
||||
"cast",
|
||||
"ciborium",
|
||||
"clap",
|
||||
"criterion-plot",
|
||||
"is-terminal",
|
||||
"itertools",
|
||||
"num-traits",
|
||||
"once_cell",
|
||||
"oorandom",
|
||||
"plotters",
|
||||
"rayon",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"tinytemplate",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "criterion-plot"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1"
|
||||
dependencies = [
|
||||
"cast",
|
||||
"itertools",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d"
|
||||
dependencies = [
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
|
||||
|
||||
[[package]]
|
||||
name = "crunchy"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
|
||||
|
||||
[[package]]
|
||||
name = "font-types"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "11c3a23a5a151afb1f74ea797f8c300dee41eff9ee3cb1bf94ed316d860c46b3"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crunchy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "540654e97a3f4470a492cd30ff187bc95d89557a903a2bbf112e2fae98104ef2"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.164"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||
|
||||
[[package]]
|
||||
name = "oorandom"
|
||||
version = "11.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9"
|
||||
|
||||
[[package]]
|
||||
name = "plotters"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
"plotters-backend",
|
||||
"plotters-svg",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "plotters-backend"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a"
|
||||
|
||||
[[package]]
|
||||
name = "plotters-svg"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670"
|
||||
dependencies = [
|
||||
"plotters-backend",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
|
||||
dependencies = [
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa"
|
||||
dependencies = [
|
||||
"either",
|
||||
"rayon-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
|
||||
dependencies = [
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "read-fonts"
|
||||
version = "0.26.0"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"core_maths",
|
||||
"criterion",
|
||||
"font-types",
|
||||
"rand",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.215"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.215"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.133"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinytemplate"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.72"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.7.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.7.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
@ -12,8 +12,9 @@
|
||||
[package]
|
||||
edition = "2021"
|
||||
name = "read-fonts"
|
||||
version = "0.25.3"
|
||||
version = "0.26.0"
|
||||
build = false
|
||||
autolib = false
|
||||
autobins = false
|
||||
autoexamples = false
|
||||
autotests = false
|
2
third_party/rust/chromium_crates_io/vendor/read-fonts-0.25.3/Cargo.toml.orig → third_party/rust/chromium_crates_io/vendor/read-fonts-0.26.0/Cargo.toml.orig
generated
vendored
2
third_party/rust/chromium_crates_io/vendor/read-fonts-0.25.3/Cargo.toml.orig → third_party/rust/chromium_crates_io/vendor/read-fonts-0.26.0/Cargo.toml.orig
generated
vendored
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "read-fonts"
|
||||
version = "0.25.3"
|
||||
version = "0.26.0"
|
||||
description = "Reading OpenType font files."
|
||||
readme = "README.md"
|
||||
categories = ["text-processing", "parsing", "graphics"]
|
@ -44,6 +44,12 @@ impl TableDirectoryMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for TableDirectoryMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.table_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for TableDirectory<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -240,6 +246,12 @@ impl TTCHeaderMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for TTCHeaderMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.table_directory_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for TTCHeader<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -58,6 +58,19 @@ impl<'a> FontRead<'a> for Lookup<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Lookup<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format0(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
Self::Format4(item) => item.min_byte_range(),
|
||||
Self::Format6(item) => item.min_byte_range(),
|
||||
Self::Format8(item) => item.min_byte_range(),
|
||||
Self::Format10(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> Lookup<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -113,6 +126,12 @@ impl Lookup0Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Lookup0Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.values_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Lookup0<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -216,6 +235,12 @@ impl Lookup2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Lookup2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.segments_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Lookup2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -362,6 +387,12 @@ impl Lookup4Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Lookup4Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.segments_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Lookup4<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -562,6 +593,12 @@ impl Lookup6Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Lookup6Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.entries_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Lookup6<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -691,6 +728,12 @@ impl Lookup8Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Lookup8Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.value_array_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Lookup8<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -801,6 +844,12 @@ impl Lookup10Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Lookup10Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.values_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Lookup10<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -908,6 +957,12 @@ impl StateHeaderMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for StateHeaderMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.entry_table_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for StateHeader<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1025,6 +1080,12 @@ impl ClassSubtableMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ClassSubtableMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.class_array_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ClassSubtable<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1102,6 +1163,12 @@ impl RawBytesMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for RawBytesMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for RawBytes<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1170,6 +1237,12 @@ impl StxHeaderMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for StxHeaderMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.entry_table_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for StxHeader<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1276,6 +1349,12 @@ impl RawWordsMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for RawWordsMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for RawWords<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -32,6 +32,12 @@ impl AnkrMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AnkrMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_data_table_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Ankr<'_> {
|
||||
/// `ankr`
|
||||
const TAG: Tag = Tag::new(b"ankr");
|
||||
@ -134,6 +140,12 @@ impl GlyphDataEntryMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for GlyphDataEntryMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.anchor_points_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for GlyphDataEntry<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -46,6 +46,12 @@ impl AvarMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AvarMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.axis_segment_maps_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Avar<'_> {
|
||||
/// `avar`
|
||||
const TAG: Tag = Tag::new(b"avar");
|
@ -34,6 +34,12 @@ impl BaseMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for BaseMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.vert_axis_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Base<'_> {
|
||||
/// `BASE`
|
||||
const TAG: Tag = Tag::new(b"BASE");
|
||||
@ -157,6 +163,12 @@ impl AxisMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AxisMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.base_script_list_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Axis<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -244,6 +256,12 @@ impl BaseTagListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for BaseTagListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.baseline_tags_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for BaseTagList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -319,6 +337,12 @@ impl BaseScriptListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for BaseScriptListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.base_script_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for BaseScriptList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -463,6 +487,12 @@ impl BaseScriptMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for BaseScriptMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.base_lang_sys_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for BaseScript<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -639,6 +669,12 @@ impl BaseValuesMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for BaseValuesMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.base_coord_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for BaseValues<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -758,6 +794,12 @@ impl MinMaxMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MinMaxMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.feat_min_max_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for MinMax<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -984,6 +1026,16 @@ impl<'a> FontRead<'a> for BaseCoord<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for BaseCoord<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
Self::Format3(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> BaseCoord<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -1033,6 +1085,12 @@ impl BaseCoordFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for BaseCoordFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.coordinate_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for BaseCoordFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1113,6 +1171,12 @@ impl BaseCoordFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for BaseCoordFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.base_coord_point_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for BaseCoordFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1204,6 +1268,12 @@ impl BaseCoordFormat3Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for BaseCoordFormat3Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.device_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for BaseCoordFormat3<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -10,11 +10,11 @@ use crate::codegen_prelude::*;
|
||||
#[repr(C)]
|
||||
#[repr(packed)]
|
||||
pub struct BitmapSize {
|
||||
/// Offset to index subtable from beginning of EBLC/CBLC.
|
||||
pub index_subtable_array_offset: BigEndian<u32>,
|
||||
/// Number of bytes in corresponding index subtables and array.
|
||||
pub index_tables_size: BigEndian<u32>,
|
||||
/// There is an index subtable for each range or format change.
|
||||
/// Offset to IndexSubtableList, from beginning of EBLC/CBLC.
|
||||
pub index_subtable_list_offset: BigEndian<u32>,
|
||||
/// Total size in bytes of the IndexSubtableList including its array of IndexSubtables.
|
||||
pub index_subtable_list_size: BigEndian<u32>,
|
||||
/// Number of IndexSubtables in the IndexSubtableList.
|
||||
pub number_of_index_subtables: BigEndian<u32>,
|
||||
/// Not used; set to 0.
|
||||
pub color_ref: BigEndian<u32>,
|
||||
@ -38,17 +38,17 @@ pub struct BitmapSize {
|
||||
}
|
||||
|
||||
impl BitmapSize {
|
||||
/// Offset to index subtable from beginning of EBLC/CBLC.
|
||||
pub fn index_subtable_array_offset(&self) -> u32 {
|
||||
self.index_subtable_array_offset.get()
|
||||
/// Offset to IndexSubtableList, from beginning of EBLC/CBLC.
|
||||
pub fn index_subtable_list_offset(&self) -> u32 {
|
||||
self.index_subtable_list_offset.get()
|
||||
}
|
||||
|
||||
/// Number of bytes in corresponding index subtables and array.
|
||||
pub fn index_tables_size(&self) -> u32 {
|
||||
self.index_tables_size.get()
|
||||
/// Total size in bytes of the IndexSubtableList including its array of IndexSubtables.
|
||||
pub fn index_subtable_list_size(&self) -> u32 {
|
||||
self.index_subtable_list_size.get()
|
||||
}
|
||||
|
||||
/// There is an index subtable for each range or format change.
|
||||
/// Number of IndexSubtables in the IndexSubtableList.
|
||||
pub fn number_of_index_subtables(&self) -> u32 {
|
||||
self.number_of_index_subtables.get()
|
||||
}
|
||||
@ -122,10 +122,13 @@ impl<'a> SomeRecord<'a> for BitmapSize {
|
||||
name: "BitmapSize",
|
||||
get_field: Box::new(move |idx, _data| match idx {
|
||||
0usize => Some(Field::new(
|
||||
"index_subtable_array_offset",
|
||||
self.index_subtable_array_offset(),
|
||||
"index_subtable_list_offset",
|
||||
self.index_subtable_list_offset(),
|
||||
)),
|
||||
1usize => Some(Field::new(
|
||||
"index_subtable_list_size",
|
||||
self.index_subtable_list_size(),
|
||||
)),
|
||||
1usize => Some(Field::new("index_tables_size", self.index_tables_size())),
|
||||
2usize => Some(Field::new(
|
||||
"number_of_index_subtables",
|
||||
self.number_of_index_subtables(),
|
||||
@ -736,74 +739,81 @@ impl<'a> SomeRecord<'a> for SmallGlyphMetrics {
|
||||
}
|
||||
}
|
||||
|
||||
/// [IndexSubtableArray](https://learn.microsoft.com/en-us/typography/opentype/spec/eblc#indexsubtablearray) table.
|
||||
/// [IndexSubtableList](https://learn.microsoft.com/en-us/typography/opentype/spec/eblc#indexsubtablelist) table.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[doc(hidden)]
|
||||
pub struct IndexSubtableArrayMarker {}
|
||||
pub struct IndexSubtableListMarker {
|
||||
index_subtable_records_byte_len: usize,
|
||||
}
|
||||
|
||||
impl IndexSubtableArrayMarker {
|
||||
pub fn first_glyph_index_byte_range(&self) -> Range<usize> {
|
||||
impl IndexSubtableListMarker {
|
||||
pub fn index_subtable_records_byte_range(&self) -> Range<usize> {
|
||||
let start = 0;
|
||||
start..start + GlyphId16::RAW_BYTE_LEN
|
||||
}
|
||||
|
||||
pub fn last_glyph_index_byte_range(&self) -> Range<usize> {
|
||||
let start = self.first_glyph_index_byte_range().end;
|
||||
start..start + GlyphId16::RAW_BYTE_LEN
|
||||
}
|
||||
|
||||
pub fn additional_offset_to_index_subtable_byte_range(&self) -> Range<usize> {
|
||||
let start = self.last_glyph_index_byte_range().end;
|
||||
start..start + u32::RAW_BYTE_LEN
|
||||
start..start + self.index_subtable_records_byte_len
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for IndexSubtableArray<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
impl MinByteRange for IndexSubtableListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.index_subtable_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for IndexSubtableList<'_> {
|
||||
type Args = u32;
|
||||
}
|
||||
|
||||
impl<'a> FontReadWithArgs<'a> for IndexSubtableList<'a> {
|
||||
fn read_with_args(data: FontData<'a>, args: &u32) -> Result<Self, ReadError> {
|
||||
let number_of_index_subtables = *args;
|
||||
let mut cursor = data.cursor();
|
||||
cursor.advance::<GlyphId16>();
|
||||
cursor.advance::<GlyphId16>();
|
||||
cursor.advance::<u32>();
|
||||
cursor.finish(IndexSubtableArrayMarker {})
|
||||
let index_subtable_records_byte_len = (number_of_index_subtables as usize)
|
||||
.checked_mul(IndexSubtableRecord::RAW_BYTE_LEN)
|
||||
.ok_or(ReadError::OutOfBounds)?;
|
||||
cursor.advance_by(index_subtable_records_byte_len);
|
||||
cursor.finish(IndexSubtableListMarker {
|
||||
index_subtable_records_byte_len,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// [IndexSubtableArray](https://learn.microsoft.com/en-us/typography/opentype/spec/eblc#indexsubtablearray) table.
|
||||
pub type IndexSubtableArray<'a> = TableRef<'a, IndexSubtableArrayMarker>;
|
||||
impl<'a> IndexSubtableList<'a> {
|
||||
/// A constructor that requires additional arguments.
|
||||
///
|
||||
/// This type requires some external state in order to be
|
||||
/// parsed.
|
||||
pub fn read(data: FontData<'a>, number_of_index_subtables: u32) -> Result<Self, ReadError> {
|
||||
let args = number_of_index_subtables;
|
||||
Self::read_with_args(data, &args)
|
||||
}
|
||||
}
|
||||
|
||||
/// [IndexSubtableList](https://learn.microsoft.com/en-us/typography/opentype/spec/eblc#indexsubtablelist) table.
|
||||
pub type IndexSubtableList<'a> = TableRef<'a, IndexSubtableListMarker>;
|
||||
|
||||
#[allow(clippy::needless_lifetimes)]
|
||||
impl<'a> IndexSubtableArray<'a> {
|
||||
/// First glyph ID of this range.
|
||||
pub fn first_glyph_index(&self) -> GlyphId16 {
|
||||
let range = self.shape.first_glyph_index_byte_range();
|
||||
self.data.read_at(range.start).unwrap()
|
||||
}
|
||||
|
||||
/// Last glyph ID of this range (inclusive).
|
||||
pub fn last_glyph_index(&self) -> GlyphId16 {
|
||||
let range = self.shape.last_glyph_index_byte_range();
|
||||
self.data.read_at(range.start).unwrap()
|
||||
}
|
||||
|
||||
/// Add to indexSubTableArrayOffset to get offset from beginning of EBLC.
|
||||
pub fn additional_offset_to_index_subtable(&self) -> u32 {
|
||||
let range = self.shape.additional_offset_to_index_subtable_byte_range();
|
||||
self.data.read_at(range.start).unwrap()
|
||||
impl<'a> IndexSubtableList<'a> {
|
||||
/// Array of IndexSubtableRecords.
|
||||
pub fn index_subtable_records(&self) -> &'a [IndexSubtableRecord] {
|
||||
let range = self.shape.index_subtable_records_byte_range();
|
||||
self.data.read_array(range).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> SomeTable<'a> for IndexSubtableArray<'a> {
|
||||
impl<'a> SomeTable<'a> for IndexSubtableList<'a> {
|
||||
fn type_name(&self) -> &str {
|
||||
"IndexSubtableArray"
|
||||
"IndexSubtableList"
|
||||
}
|
||||
fn get_field(&self, idx: usize) -> Option<Field<'a>> {
|
||||
match idx {
|
||||
0usize => Some(Field::new("first_glyph_index", self.first_glyph_index())),
|
||||
1usize => Some(Field::new("last_glyph_index", self.last_glyph_index())),
|
||||
2usize => Some(Field::new(
|
||||
"additional_offset_to_index_subtable",
|
||||
self.additional_offset_to_index_subtable(),
|
||||
0usize => Some(Field::new(
|
||||
"index_subtable_records",
|
||||
traversal::FieldType::array_of_records(
|
||||
stringify!(IndexSubtableRecord),
|
||||
self.index_subtable_records(),
|
||||
self.offset_data(),
|
||||
),
|
||||
)),
|
||||
_ => None,
|
||||
}
|
||||
@ -812,12 +822,73 @@ impl<'a> SomeTable<'a> for IndexSubtableArray<'a> {
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
#[allow(clippy::needless_lifetimes)]
|
||||
impl<'a> std::fmt::Debug for IndexSubtableArray<'a> {
|
||||
impl<'a> std::fmt::Debug for IndexSubtableList<'a> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
(self as &dyn SomeTable<'a>).fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Copy, bytemuck :: AnyBitPattern)]
|
||||
#[repr(C)]
|
||||
#[repr(packed)]
|
||||
pub struct IndexSubtableRecord {
|
||||
/// First glyph ID of this range.
|
||||
pub first_glyph_index: BigEndian<GlyphId16>,
|
||||
/// Last glyph ID of this range (inclusive).
|
||||
pub last_glyph_index: BigEndian<GlyphId16>,
|
||||
/// Offset to an IndexSubtable from the start of the IndexSubtableList.
|
||||
pub index_subtable_offset: BigEndian<Offset32>,
|
||||
}
|
||||
|
||||
impl IndexSubtableRecord {
|
||||
/// First glyph ID of this range.
|
||||
pub fn first_glyph_index(&self) -> GlyphId16 {
|
||||
self.first_glyph_index.get()
|
||||
}
|
||||
|
||||
/// Last glyph ID of this range (inclusive).
|
||||
pub fn last_glyph_index(&self) -> GlyphId16 {
|
||||
self.last_glyph_index.get()
|
||||
}
|
||||
|
||||
/// Offset to an IndexSubtable from the start of the IndexSubtableList.
|
||||
pub fn index_subtable_offset(&self) -> Offset32 {
|
||||
self.index_subtable_offset.get()
|
||||
}
|
||||
|
||||
/// Offset to an IndexSubtable from the start of the IndexSubtableList.
|
||||
///
|
||||
/// The `data` argument should be retrieved from the parent table
|
||||
/// By calling its `offset_data` method.
|
||||
pub fn index_subtable<'a>(&self, data: FontData<'a>) -> Result<IndexSubtable<'a>, ReadError> {
|
||||
self.index_subtable_offset().resolve(data)
|
||||
}
|
||||
}
|
||||
|
||||
impl FixedSize for IndexSubtableRecord {
|
||||
const RAW_BYTE_LEN: usize =
|
||||
GlyphId16::RAW_BYTE_LEN + GlyphId16::RAW_BYTE_LEN + Offset32::RAW_BYTE_LEN;
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> SomeRecord<'a> for IndexSubtableRecord {
|
||||
fn traverse(self, data: FontData<'a>) -> RecordResolver<'a> {
|
||||
RecordResolver {
|
||||
name: "IndexSubtableRecord",
|
||||
get_field: Box::new(move |idx, _data| match idx {
|
||||
0usize => Some(Field::new("first_glyph_index", self.first_glyph_index())),
|
||||
1usize => Some(Field::new("last_glyph_index", self.last_glyph_index())),
|
||||
2usize => Some(Field::new(
|
||||
"index_subtable_offset",
|
||||
FieldType::offset(self.index_subtable_offset(), self.index_subtable(_data)),
|
||||
)),
|
||||
_ => None,
|
||||
}),
|
||||
data,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [IndexSubtables](https://learn.microsoft.com/en-us/typography/opentype/spec/eblc#indexsubtables) format type.
|
||||
#[derive(Clone)]
|
||||
pub enum IndexSubtable<'a> {
|
||||
@ -888,6 +959,18 @@ impl<'a> FontRead<'a> for IndexSubtable<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for IndexSubtable<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
Self::Format3(item) => item.min_byte_range(),
|
||||
Self::Format4(item) => item.min_byte_range(),
|
||||
Self::Format5(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> IndexSubtable<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -951,6 +1034,12 @@ impl IndexSubtable1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for IndexSubtable1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.sbit_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for IndexSubtable1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1057,6 +1146,12 @@ impl IndexSubtable2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for IndexSubtable2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.big_metrics_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for IndexSubtable2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1173,6 +1268,12 @@ impl IndexSubtable3Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for IndexSubtable3Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.sbit_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for IndexSubtable3<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1279,6 +1380,12 @@ impl IndexSubtable4Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for IndexSubtable4Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_array_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for IndexSubtable4<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1455,6 +1562,12 @@ impl IndexSubtable5Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for IndexSubtable5Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_array_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for IndexSubtable5<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -22,6 +22,12 @@ impl CbdtMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CbdtMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.minor_version_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Cbdt<'_> {
|
||||
/// `CBDT`
|
||||
const TAG: Tag = Tag::new(b"CBDT");
|
@ -34,6 +34,12 @@ impl CblcMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CblcMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.bitmap_sizes_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Cblc<'_> {
|
||||
/// `CBLC`
|
||||
const TAG: Tag = Tag::new(b"CBLC");
|
@ -45,6 +45,12 @@ impl CffHeaderMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CffHeaderMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.trailing_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for CffHeader<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -51,6 +51,12 @@ impl Cff2HeaderMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Cff2HeaderMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.trailing_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Cff2Header<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -29,6 +29,12 @@ impl CmapMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CmapMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.encoding_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Cmap<'_> {
|
||||
/// `cmap`
|
||||
const TAG: Tag = Tag::new(b"cmap");
|
||||
@ -282,6 +288,22 @@ impl<'a> FontRead<'a> for CmapSubtable<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CmapSubtable<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format0(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
Self::Format4(item) => item.min_byte_range(),
|
||||
Self::Format6(item) => item.min_byte_range(),
|
||||
Self::Format8(item) => item.min_byte_range(),
|
||||
Self::Format10(item) => item.min_byte_range(),
|
||||
Self::Format12(item) => item.min_byte_range(),
|
||||
Self::Format13(item) => item.min_byte_range(),
|
||||
Self::Format14(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> CmapSubtable<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -349,6 +371,12 @@ impl Cmap0Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Cmap0Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_id_array_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Cmap0<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -453,6 +481,12 @@ impl Cmap2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Cmap2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.sub_header_keys_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Cmap2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -666,6 +700,12 @@ impl Cmap4Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Cmap4Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_id_array_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Cmap4<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -864,6 +904,12 @@ impl Cmap6Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Cmap6Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_id_array_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Cmap6<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1000,6 +1046,12 @@ impl Cmap8Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Cmap8Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.groups_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Cmap8<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1207,6 +1259,12 @@ impl Cmap10Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Cmap10Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_id_array_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Cmap10<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1337,6 +1395,12 @@ impl Cmap12Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Cmap12Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.groups_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Cmap12<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1465,6 +1529,12 @@ impl Cmap13Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Cmap13Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.groups_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Cmap13<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1635,6 +1705,12 @@ impl Cmap14Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Cmap14Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_selector_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Cmap14<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1816,6 +1892,12 @@ impl DefaultUvsMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for DefaultUvsMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.ranges_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for DefaultUvs<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1897,6 +1979,12 @@ impl NonDefaultUvsMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for NonDefaultUvsMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.uvs_mapping_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for NonDefaultUvs<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -68,6 +68,12 @@ impl ColrMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ColrMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.num_layer_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Colr<'_> {
|
||||
/// `COLR`
|
||||
const TAG: Tag = Tag::new(b"COLR");
|
||||
@ -420,6 +426,12 @@ impl BaseGlyphListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for BaseGlyphListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.base_glyph_paint_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for BaseGlyphList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -554,6 +566,12 @@ impl LayerListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for LayerListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.paint_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for LayerList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -651,6 +669,12 @@ impl ClipListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ClipListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.clips_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ClipList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -848,6 +872,15 @@ impl<'a> FontRead<'a> for ClipBox<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ClipBox<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> ClipBox<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -911,6 +944,12 @@ impl ClipBoxFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ClipBoxFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.y_max_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ClipBoxFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1025,6 +1064,12 @@ impl ClipBoxFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ClipBoxFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ClipBoxFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1331,6 +1376,12 @@ impl ColorLineMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ColorLineMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.color_stops_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ColorLine<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1423,6 +1474,12 @@ impl VarColorLineMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for VarColorLineMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.color_stops_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for VarColorLine<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1717,6 +1774,45 @@ impl<'a> FontRead<'a> for Paint<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Paint<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::ColrLayers(item) => item.min_byte_range(),
|
||||
Self::Solid(item) => item.min_byte_range(),
|
||||
Self::VarSolid(item) => item.min_byte_range(),
|
||||
Self::LinearGradient(item) => item.min_byte_range(),
|
||||
Self::VarLinearGradient(item) => item.min_byte_range(),
|
||||
Self::RadialGradient(item) => item.min_byte_range(),
|
||||
Self::VarRadialGradient(item) => item.min_byte_range(),
|
||||
Self::SweepGradient(item) => item.min_byte_range(),
|
||||
Self::VarSweepGradient(item) => item.min_byte_range(),
|
||||
Self::Glyph(item) => item.min_byte_range(),
|
||||
Self::ColrGlyph(item) => item.min_byte_range(),
|
||||
Self::Transform(item) => item.min_byte_range(),
|
||||
Self::VarTransform(item) => item.min_byte_range(),
|
||||
Self::Translate(item) => item.min_byte_range(),
|
||||
Self::VarTranslate(item) => item.min_byte_range(),
|
||||
Self::Scale(item) => item.min_byte_range(),
|
||||
Self::VarScale(item) => item.min_byte_range(),
|
||||
Self::ScaleAroundCenter(item) => item.min_byte_range(),
|
||||
Self::VarScaleAroundCenter(item) => item.min_byte_range(),
|
||||
Self::ScaleUniform(item) => item.min_byte_range(),
|
||||
Self::VarScaleUniform(item) => item.min_byte_range(),
|
||||
Self::ScaleUniformAroundCenter(item) => item.min_byte_range(),
|
||||
Self::VarScaleUniformAroundCenter(item) => item.min_byte_range(),
|
||||
Self::Rotate(item) => item.min_byte_range(),
|
||||
Self::VarRotate(item) => item.min_byte_range(),
|
||||
Self::RotateAroundCenter(item) => item.min_byte_range(),
|
||||
Self::VarRotateAroundCenter(item) => item.min_byte_range(),
|
||||
Self::Skew(item) => item.min_byte_range(),
|
||||
Self::VarSkew(item) => item.min_byte_range(),
|
||||
Self::SkewAroundCenter(item) => item.min_byte_range(),
|
||||
Self::VarSkewAroundCenter(item) => item.min_byte_range(),
|
||||
Self::Composite(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> Paint<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -1800,6 +1896,12 @@ impl PaintColrLayersMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintColrLayersMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.first_layer_index_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintColrLayers<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1883,6 +1985,12 @@ impl PaintSolidMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintSolidMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.alpha_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintSolid<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1971,6 +2079,12 @@ impl PaintVarSolidMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarSolidMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarSolid<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2087,6 +2201,12 @@ impl PaintLinearGradientMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintLinearGradientMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.y2_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintLinearGradient<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2249,6 +2369,12 @@ impl PaintVarLinearGradientMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarLinearGradientMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarLinearGradient<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2420,6 +2546,12 @@ impl PaintRadialGradientMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintRadialGradientMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.radius1_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintRadialGradient<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2582,6 +2714,12 @@ impl PaintVarRadialGradientMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarRadialGradientMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarRadialGradient<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2741,6 +2879,12 @@ impl PaintSweepGradientMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintSweepGradientMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.end_angle_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintSweepGradient<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2879,6 +3023,12 @@ impl PaintVarSweepGradientMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarSweepGradientMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarSweepGradient<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3007,6 +3157,12 @@ impl PaintGlyphMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintGlyphMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_id_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintGlyph<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3094,6 +3250,12 @@ impl PaintColrGlyphMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintColrGlyphMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_id_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintColrGlyph<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3169,6 +3331,12 @@ impl PaintTransformMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintTransformMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.transform_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintTransform<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3270,6 +3438,12 @@ impl PaintVarTransformMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarTransformMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.transform_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarTransform<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3382,6 +3556,12 @@ impl Affine2x3Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Affine2x3Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.dy_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Affine2x3<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3505,6 +3685,12 @@ impl VarAffine2x3Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for VarAffine2x3Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for VarAffine2x3<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3629,6 +3815,12 @@ impl PaintTranslateMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintTranslateMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.dy_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintTranslate<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3739,6 +3931,12 @@ impl PaintVarTranslateMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarTranslateMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarTranslate<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3852,6 +4050,12 @@ impl PaintScaleMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintScaleMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.scale_y_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintScale<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3962,6 +4166,12 @@ impl PaintVarScaleMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarScaleMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarScale<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4087,6 +4297,12 @@ impl PaintScaleAroundCenterMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintScaleAroundCenterMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.center_y_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintScaleAroundCenter<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4223,6 +4439,12 @@ impl PaintVarScaleAroundCenterMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarScaleAroundCenterMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarScaleAroundCenter<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4351,6 +4573,12 @@ impl PaintScaleUniformMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintScaleUniformMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.scale_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintScaleUniform<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4448,6 +4676,12 @@ impl PaintVarScaleUniformMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarScaleUniformMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarScaleUniform<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4559,6 +4793,12 @@ impl PaintScaleUniformAroundCenterMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintScaleUniformAroundCenterMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.center_y_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintScaleUniformAroundCenter<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4682,6 +4922,12 @@ impl PaintVarScaleUniformAroundCenterMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarScaleUniformAroundCenterMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarScaleUniformAroundCenter<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4802,6 +5048,12 @@ impl PaintRotateMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintRotateMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.angle_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintRotate<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4900,6 +5152,12 @@ impl PaintVarRotateMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarRotateMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarRotate<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -5011,6 +5269,12 @@ impl PaintRotateAroundCenterMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintRotateAroundCenterMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.center_y_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintRotateAroundCenter<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -5135,6 +5399,12 @@ impl PaintVarRotateAroundCenterMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarRotateAroundCenterMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarRotateAroundCenter<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -5259,6 +5529,12 @@ impl PaintSkewMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintSkewMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.y_skew_angle_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintSkew<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -5371,6 +5647,12 @@ impl PaintVarSkewMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarSkewMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarSkew<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -5498,6 +5780,12 @@ impl PaintSkewAroundCenterMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintSkewAroundCenterMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.center_y_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintSkewAroundCenter<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -5636,6 +5924,12 @@ impl PaintVarSkewAroundCenterMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintVarSkewAroundCenterMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_base_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintVarSkewAroundCenter<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -5771,6 +6065,12 @@ impl PaintCompositeMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PaintCompositeMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.backdrop_paint_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PaintComposite<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -62,6 +62,12 @@ impl CpalMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CpalMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.color_record_indices_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Cpal<'_> {
|
||||
/// `CPAL`
|
||||
const TAG: Tag = Tag::new(b"CPAL");
|
@ -34,6 +34,12 @@ impl CvarMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CvarMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.tuple_variation_headers_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Cvar<'_> {
|
||||
/// `cvar`
|
||||
const TAG: Tag = Tag::new(b"cvar");
|
@ -22,6 +22,12 @@ impl EbdtMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for EbdtMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.minor_version_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Ebdt<'_> {
|
||||
/// `EBDT`
|
||||
const TAG: Tag = Tag::new(b"EBDT");
|
@ -34,6 +34,12 @@ impl EblcMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for EblcMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.bitmap_sizes_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Eblc<'_> {
|
||||
/// `EBLC`
|
||||
const TAG: Tag = Tag::new(b"EBLC");
|
@ -39,6 +39,12 @@ impl FeatMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FeatMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.names_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Feat<'_> {
|
||||
/// `feat`
|
||||
const TAG: Tag = Tag::new(b"feat");
|
||||
@ -215,6 +221,12 @@ impl SettingNameArrayMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SettingNameArrayMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.settings_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for SettingNameArray<'_> {
|
||||
type Args = u16;
|
||||
}
|
@ -47,6 +47,12 @@ impl FvarMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FvarMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.instance_size_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Fvar<'_> {
|
||||
/// `fvar`
|
||||
const TAG: Tag = Tag::new(b"fvar");
|
||||
@ -176,6 +182,12 @@ impl AxisInstanceArraysMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AxisInstanceArraysMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.instances_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for AxisInstanceArrays<'_> {
|
||||
type Args = (u16, u16, u16);
|
||||
}
|
@ -29,6 +29,12 @@ impl GaspMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for GaspMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.gasp_ranges_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Gasp<'_> {
|
||||
/// `gasp`
|
||||
const TAG: Tag = Tag::new(b"gasp");
|
@ -50,6 +50,12 @@ impl GdefMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for GdefMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.mark_attach_class_def_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Gdef<'_> {
|
||||
/// `GDEF`
|
||||
const TAG: Tag = Tag::new(b"GDEF");
|
||||
@ -299,6 +305,12 @@ impl AttachListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AttachListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.attach_point_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for AttachList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -410,6 +422,12 @@ impl AttachPointMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AttachPointMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.point_indices_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for AttachPoint<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -488,6 +506,12 @@ impl LigCaretListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for LigCaretListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.lig_glyph_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for LigCaretList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -599,6 +623,12 @@ impl LigGlyphMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for LigGlyphMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.caret_value_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for LigGlyph<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -714,6 +744,16 @@ impl<'a> FontRead<'a> for CaretValue<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CaretValue<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
Self::Format3(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> CaretValue<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -763,6 +803,12 @@ impl CaretValueFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CaretValueFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.coordinate_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for CaretValueFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -833,6 +879,12 @@ impl CaretValueFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CaretValueFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.caret_value_point_index_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for CaretValueFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -911,6 +963,12 @@ impl CaretValueFormat3Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CaretValueFormat3Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.device_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for CaretValueFormat3<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1007,6 +1065,12 @@ impl MarkGlyphSetsMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MarkGlyphSetsMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.coverage_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for MarkGlyphSets<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -109,6 +109,12 @@ impl SimpleGlyphMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SimpleGlyphMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SimpleGlyph<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -670,6 +676,12 @@ impl CompositeGlyphMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CompositeGlyphMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.component_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for CompositeGlyph<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1208,6 +1220,15 @@ impl<'a> FontRead<'a> for Glyph<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Glyph<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Simple(item) => item.min_byte_range(),
|
||||
Self::Composite(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> Glyph<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
@ -40,6 +40,12 @@ impl GposMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for GposMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.lookup_list_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Gpos<'_> {
|
||||
/// `GPOS`
|
||||
const TAG: Tag = Tag::new(b"GPOS");
|
||||
@ -653,6 +659,16 @@ impl<'a> FontRead<'a> for AnchorTable<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AnchorTable<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
Self::Format3(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> AnchorTable<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -707,6 +723,12 @@ impl AnchorFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AnchorFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.y_coordinate_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for AnchorFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -795,6 +817,12 @@ impl AnchorFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AnchorFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.anchor_point_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for AnchorFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -896,6 +924,12 @@ impl AnchorFormat3Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AnchorFormat3Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.y_device_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for AnchorFormat3<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1010,6 +1044,12 @@ impl MarkArrayMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MarkArrayMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.mark_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for MarkArray<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1177,6 +1217,15 @@ impl<'a> FontRead<'a> for SinglePos<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SinglePos<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> SinglePos<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -1237,6 +1286,12 @@ impl SinglePosFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SinglePosFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.value_record_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SinglePosFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1358,6 +1413,12 @@ impl SinglePosFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SinglePosFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.value_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SinglePosFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1517,6 +1578,15 @@ impl<'a> FontRead<'a> for PairPos<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PairPos<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> PairPos<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -1587,6 +1657,12 @@ impl PairPosFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PairPosFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.pair_set_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PairPosFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1728,6 +1804,12 @@ impl PairSetMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PairSetMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.pair_value_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for PairSet<'_> {
|
||||
type Args = (ValueFormat, ValueFormat);
|
||||
}
|
||||
@ -1991,6 +2073,12 @@ impl PairPosFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PairPosFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.class1_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PairPosFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2359,6 +2447,12 @@ impl CursivePosFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CursivePosFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.entry_exit_record_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for CursivePosFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2562,6 +2656,12 @@ impl MarkBasePosFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MarkBasePosFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.base_array_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for MarkBasePosFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2704,6 +2804,12 @@ impl BaseArrayMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for BaseArrayMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.base_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for BaseArray<'_> {
|
||||
type Args = u16;
|
||||
}
|
||||
@ -2925,6 +3031,12 @@ impl MarkLigPosFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MarkLigPosFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.ligature_array_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for MarkLigPosFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3067,6 +3179,12 @@ impl LigatureArrayMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for LigatureArrayMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.ligature_attach_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for LigatureArray<'_> {
|
||||
type Args = u16;
|
||||
}
|
||||
@ -3186,6 +3304,12 @@ impl LigatureAttachMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for LigatureAttachMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.component_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for LigatureAttach<'_> {
|
||||
type Args = u16;
|
||||
}
|
||||
@ -3407,6 +3531,12 @@ impl MarkMarkPosFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MarkMarkPosFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.mark2_array_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for MarkMarkPosFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3549,6 +3679,12 @@ impl Mark2ArrayMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Mark2ArrayMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.mark2_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for Mark2Array<'_> {
|
||||
type Args = u16;
|
||||
}
|
||||
@ -3757,6 +3893,12 @@ impl<T> ExtensionPosFormat1Marker<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ExtensionPosFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.extension_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Clone for ExtensionPosFormat1Marker<T> {
|
||||
fn clone(&self) -> Self {
|
||||
*self
|
@ -39,6 +39,12 @@ impl GsubMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for GsubMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.lookup_list_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Gsub<'_> {
|
||||
/// `GSUB`
|
||||
const TAG: Tag = Tag::new(b"GSUB");
|
||||
@ -292,6 +298,15 @@ impl<'a> FontRead<'a> for SingleSubst<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SingleSubst<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> SingleSubst<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -345,6 +360,12 @@ impl SingleSubstFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SingleSubstFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.delta_glyph_id_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SingleSubstFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -445,6 +466,12 @@ impl SingleSubstFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SingleSubstFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.substitute_glyph_ids_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SingleSubstFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -561,6 +588,12 @@ impl MultipleSubstFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MultipleSubstFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.sequence_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for MultipleSubstFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -681,6 +714,12 @@ impl SequenceMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SequenceMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.substitute_glyph_ids_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Sequence<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -772,6 +811,12 @@ impl AlternateSubstFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AlternateSubstFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.alternate_set_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for AlternateSubstFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -895,6 +940,12 @@ impl AlternateSetMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AlternateSetMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.alternate_glyph_ids_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for AlternateSet<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -985,6 +1036,12 @@ impl LigatureSubstFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for LigatureSubstFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.ligature_set_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for LigatureSubstFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1105,6 +1162,12 @@ impl LigatureSetMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for LigatureSetMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.ligature_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for LigatureSet<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1204,6 +1267,12 @@ impl LigatureMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for LigatureMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.component_glyph_ids_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Ligature<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1298,6 +1367,12 @@ impl<T> ExtensionSubstFormat1Marker<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ExtensionSubstFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.extension_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Clone for ExtensionSubstFormat1Marker<T> {
|
||||
fn clone(&self) -> Self {
|
||||
*self
|
||||
@ -1542,6 +1617,12 @@ impl ReverseChainSingleSubstFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ReverseChainSingleSubstFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.substitute_glyph_ids_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ReverseChainSingleSubstFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -54,6 +54,12 @@ impl GvarMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for GvarMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_variation_data_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Gvar<'_> {
|
||||
/// `gvar`
|
||||
const TAG: Tag = Tag::new(b"gvar");
|
||||
@ -502,6 +508,12 @@ impl SharedTuplesMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SharedTuplesMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.tuples_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for SharedTuples<'_> {
|
||||
type Args = (u16, u16);
|
||||
}
|
||||
@ -599,6 +611,12 @@ impl GlyphVariationDataHeaderMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for GlyphVariationDataHeaderMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.tuple_variation_headers_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for GlyphVariationDataHeader<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -35,6 +35,12 @@ impl HdmxMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for HdmxMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Hdmx<'_> {
|
||||
/// `hdmx`
|
||||
const TAG: Tag = Tag::new(b"hdmx");
|
@ -432,6 +432,12 @@ impl HeadMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for HeadMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_data_format_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Head<'_> {
|
||||
/// `head`
|
||||
const TAG: Tag = Tag::new(b"head");
|
@ -91,12 +91,18 @@ impl HheaMarker {
|
||||
start..start + i16::RAW_BYTE_LEN
|
||||
}
|
||||
|
||||
pub fn number_of_long_metrics_byte_range(&self) -> Range<usize> {
|
||||
pub fn number_of_h_metrics_byte_range(&self) -> Range<usize> {
|
||||
let start = self.metric_data_format_byte_range().end;
|
||||
start..start + u16::RAW_BYTE_LEN
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for HheaMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.number_of_h_metrics_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Hhea<'_> {
|
||||
/// `hhea`
|
||||
const TAG: Tag = Tag::new(b"hhea");
|
||||
@ -209,9 +215,9 @@ impl<'a> Hhea<'a> {
|
||||
self.data.read_at(range.start).unwrap()
|
||||
}
|
||||
|
||||
/// Number of LongMetric entries in 'hmtx'/'vmtx' table
|
||||
pub fn number_of_long_metrics(&self) -> u16 {
|
||||
let range = self.shape.number_of_long_metrics_byte_range();
|
||||
/// Number of hMetric entries in 'hmtx' table
|
||||
pub fn number_of_h_metrics(&self) -> u16 {
|
||||
let range = self.shape.number_of_h_metrics_byte_range();
|
||||
self.data.read_at(range.start).unwrap()
|
||||
}
|
||||
}
|
||||
@ -242,8 +248,8 @@ impl<'a> SomeTable<'a> for Hhea<'a> {
|
||||
10usize => Some(Field::new("caret_offset", self.caret_offset())),
|
||||
11usize => Some(Field::new("metric_data_format", self.metric_data_format())),
|
||||
12usize => Some(Field::new(
|
||||
"number_of_long_metrics",
|
||||
self.number_of_long_metrics(),
|
||||
"number_of_h_metrics",
|
||||
self.number_of_h_metrics(),
|
||||
)),
|
||||
_ => None,
|
||||
}
|
@ -25,6 +25,12 @@ impl HmtxMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for HmtxMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.left_side_bearings_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Hmtx<'_> {
|
||||
/// `hmtx`
|
||||
const TAG: Tag = Tag::new(b"hmtx");
|
@ -37,6 +37,12 @@ impl HvarMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for HvarMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.rsb_mapping_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Hvar<'_> {
|
||||
/// `HVAR`
|
||||
const TAG: Tag = Tag::new(b"HVAR");
|
@ -62,6 +62,15 @@ impl<'a> FontRead<'a> for Ift<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Ift<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> Ift<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -163,6 +172,12 @@ impl PatchMapFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PatchMapFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.patch_format_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PatchMapFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -341,6 +356,12 @@ impl GlyphMapMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for GlyphMapMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.entry_index_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for GlyphMap<'_> {
|
||||
type Args = (Uint24, u16);
|
||||
}
|
||||
@ -444,6 +465,12 @@ impl FeatureMapMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FeatureMapMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.entry_map_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for FeatureMap<'_> {
|
||||
type Args = u16;
|
||||
}
|
||||
@ -753,6 +780,12 @@ impl PatchMapFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PatchMapFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.uri_template_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for PatchMapFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -894,6 +927,12 @@ impl MappingEntriesMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MappingEntriesMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.entry_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for MappingEntries<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1007,6 +1046,12 @@ impl EntryDataMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for EntryDataMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.codepoint_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for EntryData<'_> {
|
||||
type Args = Offset32;
|
||||
}
|
||||
@ -1643,6 +1688,12 @@ impl IdStringDataMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for IdStringDataMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.id_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for IdStringData<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1717,6 +1768,12 @@ impl TableKeyedPatchMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for TableKeyedPatchMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.patch_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for TableKeyedPatch<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1837,6 +1894,12 @@ impl TablePatchMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for TablePatchMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.brotli_stream_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for TablePatch<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2248,6 +2311,12 @@ impl GlyphKeyedPatchMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for GlyphKeyedPatchMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.brotli_stream_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for GlyphKeyedPatch<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2668,6 +2737,12 @@ impl GlyphPatchesMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for GlyphPatchesMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_data_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for GlyphPatches<'_> {
|
||||
type Args = GlyphKeyedFlags;
|
||||
}
|
||||
@ -2804,6 +2879,12 @@ impl GlyphDataMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for GlyphDataMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for GlyphData<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -24,6 +24,12 @@ impl ScriptListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ScriptListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.script_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ScriptList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -162,6 +168,12 @@ impl ScriptMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ScriptMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.lang_sys_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Script<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -323,6 +335,12 @@ impl LangSysMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for LangSysMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.feature_indices_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for LangSys<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -413,6 +431,12 @@ impl FeatureListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FeatureListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.feature_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for FeatureList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -554,6 +578,12 @@ impl FeatureMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FeatureMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.lookup_list_indices_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for Feature<'_> {
|
||||
type Args = Tag;
|
||||
}
|
||||
@ -671,6 +701,12 @@ impl<T> LookupListMarker<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for LookupListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.lookup_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Clone for LookupListMarker<T> {
|
||||
fn clone(&self) -> Self {
|
||||
*self
|
||||
@ -823,6 +859,12 @@ impl<T> LookupMarker<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for LookupMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.subtable_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Clone for LookupMarker<T> {
|
||||
fn clone(&self) -> Self {
|
||||
*self
|
||||
@ -1006,6 +1048,12 @@ impl CoverageFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CoverageFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_array_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for CoverageFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1096,6 +1144,12 @@ impl CoverageFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CoverageFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.range_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for CoverageFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1255,6 +1309,15 @@ impl<'a> FontRead<'a> for CoverageTable<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CoverageTable<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> CoverageTable<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -1315,6 +1378,12 @@ impl ClassDefFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ClassDefFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.class_value_array_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ClassDefFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1413,6 +1482,12 @@ impl ClassDefFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ClassDefFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.class_range_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ClassDefFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1569,6 +1644,15 @@ impl<'a> FontRead<'a> for ClassDef<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ClassDef<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> ClassDef<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -1671,6 +1755,12 @@ impl SequenceContextFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SequenceContextFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.seq_rule_set_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SequenceContextFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1791,6 +1881,12 @@ impl SequenceRuleSetMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SequenceRuleSetMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.seq_rule_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SequenceRuleSet<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1896,6 +1992,12 @@ impl SequenceRuleMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SequenceRuleMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.seq_lookup_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SequenceRule<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2015,6 +2117,12 @@ impl SequenceContextFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SequenceContextFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.class_seq_rule_set_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SequenceContextFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2158,6 +2266,12 @@ impl ClassSequenceRuleSetMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ClassSequenceRuleSetMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.class_seq_rule_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ClassSequenceRuleSet<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2266,6 +2380,12 @@ impl ClassSequenceRuleMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ClassSequenceRuleMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.seq_lookup_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ClassSequenceRule<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2387,6 +2507,12 @@ impl SequenceContextFormat3Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SequenceContextFormat3Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.seq_lookup_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SequenceContextFormat3<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2536,6 +2662,16 @@ impl<'a> FontRead<'a> for SequenceContext<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SequenceContext<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
Self::Format3(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> SequenceContext<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -2597,6 +2733,12 @@ impl ChainedSequenceContextFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ChainedSequenceContextFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.chained_seq_rule_set_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ChainedSequenceContextFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2722,6 +2864,12 @@ impl ChainedSequenceRuleSetMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ChainedSequenceRuleSetMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.chained_seq_rule_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ChainedSequenceRuleSet<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -2852,6 +3000,12 @@ impl ChainedSequenceRuleMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ChainedSequenceRuleMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.seq_lookup_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ChainedSequenceRule<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3027,6 +3181,12 @@ impl ChainedSequenceContextFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ChainedSequenceContextFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.chained_class_seq_rule_set_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ChainedSequenceContextFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3213,6 +3373,12 @@ impl ChainedClassSequenceRuleSetMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ChainedClassSequenceRuleSetMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.chained_class_seq_rule_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ChainedClassSequenceRuleSet<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3345,6 +3511,12 @@ impl ChainedClassSequenceRuleMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ChainedClassSequenceRuleMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.seq_lookup_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ChainedClassSequenceRule<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3534,6 +3706,12 @@ impl ChainedSequenceContextFormat3Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ChainedSequenceContextFormat3Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.seq_lookup_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ChainedSequenceContextFormat3<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3768,6 +3946,16 @@ impl<'a> FontRead<'a> for ChainedSequenceContext<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ChainedSequenceContext<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
Self::Format3(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> ChainedSequenceContext<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -3879,6 +4067,12 @@ impl DeviceMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for DeviceMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.delta_value_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Device<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -3971,6 +4165,12 @@ impl VariationIndexMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for VariationIndexMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.delta_format_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for VariationIndex<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4070,6 +4270,15 @@ impl<'a> FontRead<'a> for DeviceOrVariationIndex<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for DeviceOrVariationIndex<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Device(item) => item.min_byte_range(),
|
||||
Self::VariationIndex(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> DeviceOrVariationIndex<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -4121,6 +4330,12 @@ impl FeatureVariationsMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FeatureVariationsMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.feature_variation_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for FeatureVariations<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4290,6 +4505,12 @@ impl ConditionSetMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ConditionSetMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.condition_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ConditionSet<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4416,6 +4637,18 @@ impl<'a> FontRead<'a> for Condition<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Condition<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1AxisRange(item) => item.min_byte_range(),
|
||||
Self::Format2VariableValue(item) => item.min_byte_range(),
|
||||
Self::Format3And(item) => item.min_byte_range(),
|
||||
Self::Format4Or(item) => item.min_byte_range(),
|
||||
Self::Format5Negate(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> Condition<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -4477,6 +4710,12 @@ impl ConditionFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ConditionFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.filter_range_max_value_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ConditionFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4577,6 +4816,12 @@ impl ConditionFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ConditionFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_index_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ConditionFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4662,6 +4907,12 @@ impl ConditionFormat3Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ConditionFormat3Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.condition_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ConditionFormat3<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4772,6 +5023,12 @@ impl ConditionFormat4Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ConditionFormat4Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.condition_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ConditionFormat4<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4875,6 +5132,12 @@ impl ConditionFormat5Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ConditionFormat5Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.condition_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ConditionFormat5<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -4957,6 +5220,12 @@ impl FeatureTableSubstitutionMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FeatureTableSubstitutionMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.substitutions_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for FeatureTableSubstitution<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -5107,6 +5376,12 @@ impl SizeParamsMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SizeParamsMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.range_end_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SizeParams<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -5215,6 +5490,12 @@ impl StylisticSetParamsMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for StylisticSetParamsMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.ui_name_id_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for StylisticSetParams<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -5323,6 +5604,12 @@ impl CharacterVariantParamsMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CharacterVariantParamsMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.character_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for CharacterVariantParams<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -34,6 +34,12 @@ impl LtagMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for LtagMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.tag_ranges_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Ltag<'_> {
|
||||
/// `ltag`
|
||||
const TAG: Tag = Tag::new(b"ltag");
|
@ -101,6 +101,12 @@ impl MaxpMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MaxpMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.num_glyphs_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Maxp<'_> {
|
||||
/// `maxp`
|
||||
const TAG: Tag = Tag::new(b"maxp");
|
@ -39,6 +39,12 @@ impl MetaMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MetaMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.data_maps_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Meta<'_> {
|
||||
/// `meta`
|
||||
const TAG: Tag = Tag::new(b"meta");
|
@ -44,6 +44,12 @@ impl MvarMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MvarMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.value_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Mvar<'_> {
|
||||
/// `MVAR`
|
||||
const TAG: Tag = Tag::new(b"MVAR");
|
@ -47,6 +47,12 @@ impl NameMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for NameMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.name_record_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Name<'_> {
|
||||
/// `name`
|
||||
const TAG: Tag = Tag::new(b"name");
|
@ -571,6 +571,12 @@ impl Os2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Os2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.us_win_descent_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Os2<'_> {
|
||||
/// `OS/2`
|
||||
const TAG: Tag = Tag::new(b"OS/2");
|
@ -78,6 +78,12 @@ impl PostMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for PostMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.max_mem_type1_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Post<'_> {
|
||||
/// `post`
|
||||
const TAG: Tag = Tag::new(b"post");
|
@ -35,6 +35,12 @@ impl Index1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Index1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Index1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -137,6 +143,12 @@ impl Index2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Index2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Index2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -249,6 +261,16 @@ impl<'a> FontRead<'a> for FdSelect<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FdSelect<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format0(item) => item.min_byte_range(),
|
||||
Self::Format3(item) => item.min_byte_range(),
|
||||
Self::Format4(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> FdSelect<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -300,6 +322,12 @@ impl FdSelectFormat0Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FdSelectFormat0Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.fds_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for FdSelectFormat0<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -383,6 +411,12 @@ impl FdSelectFormat3Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FdSelectFormat3Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.sentinel_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for FdSelectFormat3<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -533,6 +567,12 @@ impl FdSelectFormat4Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FdSelectFormat4Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.sentinel_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for FdSelectFormat4<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -343,6 +343,12 @@ impl SbixMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SbixMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.strike_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Sbix<'_> {
|
||||
/// `sbix`
|
||||
const TAG: Tag = Tag::new(b"sbix");
|
||||
@ -487,6 +493,12 @@ impl StrikeMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for StrikeMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.glyph_data_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for Strike<'_> {
|
||||
type Args = u16;
|
||||
}
|
||||
@ -594,6 +606,12 @@ impl GlyphDataMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for GlyphDataMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for GlyphData<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -49,6 +49,12 @@ impl StatMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for StatMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.offset_to_axis_value_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Stat<'_> {
|
||||
/// `STAT`
|
||||
const TAG: Tag = Tag::new(b"STAT");
|
||||
@ -265,6 +271,12 @@ impl AxisValueArrayMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AxisValueArrayMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.axis_value_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for AxisValueArray<'_> {
|
||||
type Args = u16;
|
||||
}
|
||||
@ -413,6 +425,17 @@ impl<'a> FontRead<'a> for AxisValue<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AxisValue<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::Format2(item) => item.min_byte_range(),
|
||||
Self::Format3(item) => item.min_byte_range(),
|
||||
Self::Format4(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> AxisValue<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -478,6 +501,12 @@ impl AxisValueFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AxisValueFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.value_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for AxisValueFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -600,6 +629,12 @@ impl AxisValueFormat2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AxisValueFormat2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.range_max_value_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for AxisValueFormat2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -735,6 +770,12 @@ impl AxisValueFormat3Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AxisValueFormat3Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.linked_value_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for AxisValueFormat3<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -857,6 +898,12 @@ impl AxisValueFormat4Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for AxisValueFormat4Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.axis_values_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for AxisValueFormat4<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -27,6 +27,12 @@ impl SvgMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SvgMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self._reserved_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Svg<'_> {
|
||||
/// `SVG `
|
||||
const TAG: Tag = Tag::new(b"SVG ");
|
||||
@ -111,6 +117,12 @@ impl SVGDocumentListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SVGDocumentListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.document_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SVGDocumentList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -34,6 +34,12 @@ impl MajorMinorVersionMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MajorMinorVersionMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.always_present_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for MajorMinorVersion<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -454,6 +460,12 @@ impl FlagDayMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FlagDayMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.flags_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for FlagDay<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -601,6 +613,12 @@ impl FieldsAfterConditionalsMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for FieldsAfterConditionalsMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.and_me_too_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for FieldsAfterConditionals<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -23,6 +23,12 @@ impl CountAll16Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CountAll16Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.remainder_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for CountAll16<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -88,6 +94,12 @@ impl CountAll32Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for CountAll32Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.remainder_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for CountAll32<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -30,6 +30,12 @@ impl Table1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Table1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.flex_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Table1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -110,6 +116,12 @@ impl Table2Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Table2Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.values_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Table2<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -186,6 +198,12 @@ impl Table3Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for Table3Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.something_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Table3<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -270,6 +288,16 @@ impl<'a> FontRead<'a> for MyTable<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MyTable<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
Self::MyFormat22(item) => item.min_byte_range(),
|
||||
Self::Format3(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> MyTable<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
@ -60,6 +60,12 @@ impl KindsOfOffsetsMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for KindsOfOffsetsMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.record_array_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for KindsOfOffsets<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -315,6 +321,12 @@ impl KindsOfArraysOfOffsetsMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for KindsOfArraysOfOffsetsMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.nullable_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for KindsOfArraysOfOffsets<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -554,6 +566,12 @@ impl KindsOfArraysMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for KindsOfArraysMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for KindsOfArrays<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -709,6 +727,12 @@ impl VarLenHaverMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for VarLenHaverMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.other_field_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for VarLenHaver<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -782,6 +806,12 @@ impl DummyMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for DummyMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self._reserved_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for Dummy<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -39,6 +39,12 @@ impl BasicTableMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for BasicTableMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.array_records_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for BasicTable<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -44,6 +44,12 @@ impl VarcMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for VarcMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.var_composite_glyphs_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Varc<'_> {
|
||||
/// `VARC`
|
||||
const TAG: Tag = Tag::new(b"VARC");
|
||||
@ -209,6 +215,12 @@ impl MultiItemVariationStoreMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MultiItemVariationStoreMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.variation_data_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for MultiItemVariationStore<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -326,6 +338,12 @@ impl SparseVariationRegionListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SparseVariationRegionListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.region_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SparseVariationRegionList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -415,6 +433,12 @@ impl SparseVariationRegionMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for SparseVariationRegionMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.region_axis_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for SparseVariationRegion<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -556,6 +580,12 @@ impl MultiItemVariationDataMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for MultiItemVariationDataMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.raw_delta_sets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for MultiItemVariationData<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -642,6 +672,12 @@ impl ConditionListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ConditionListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.condition_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ConditionList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -41,6 +41,12 @@ impl TupleVariationHeaderMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for TupleVariationHeaderMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.intermediate_end_tuple_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl ReadArgs for TupleVariationHeader<'_> {
|
||||
type Args = u16;
|
||||
}
|
||||
@ -236,6 +242,12 @@ impl DeltaSetIndexMapFormat0Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for DeltaSetIndexMapFormat0Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.map_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for DeltaSetIndexMapFormat0<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -338,6 +350,12 @@ impl DeltaSetIndexMapFormat1Marker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for DeltaSetIndexMapFormat1Marker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.map_data_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for DeltaSetIndexMapFormat1<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -460,6 +478,15 @@ impl<'a> FontRead<'a> for DeltaSetIndexMap<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for DeltaSetIndexMap<'_> {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
match self {
|
||||
Self::Format0(item) => item.min_byte_range(),
|
||||
Self::Format1(item) => item.min_byte_range(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
impl<'a> DeltaSetIndexMap<'a> {
|
||||
fn dyn_inner<'b>(&'b self) -> &'b dyn SomeTable<'a> {
|
||||
@ -822,6 +849,12 @@ impl VariationRegionListMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for VariationRegionListMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.variation_regions_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for VariationRegionList<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1046,6 +1079,12 @@ impl ItemVariationStoreMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ItemVariationStoreMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.item_variation_data_offsets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ItemVariationStore<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
||||
@ -1190,6 +1229,12 @@ impl ItemVariationDataMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for ItemVariationDataMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.delta_sets_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FontRead<'a> for ItemVariationData<'a> {
|
||||
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
|
||||
let mut cursor = data.cursor();
|
@ -97,6 +97,12 @@ impl VheaMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for VheaMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.number_of_long_ver_metrics_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Vhea<'_> {
|
||||
/// `vhea`
|
||||
const TAG: Tag = Tag::new(b"vhea");
|
||||
@ -208,7 +214,7 @@ impl<'a> Vhea<'a> {
|
||||
self.data.read_at(range.start).unwrap()
|
||||
}
|
||||
|
||||
/// Number of LongMetric entries in 'hmtx'/'vmtx' table
|
||||
/// Number of advance heights in the vertical metrics (`vmtx`) table.
|
||||
pub fn number_of_long_ver_metrics(&self) -> u16 {
|
||||
let range = self.shape.number_of_long_ver_metrics_byte_range();
|
||||
self.data.read_at(range.start).unwrap()
|
@ -25,6 +25,12 @@ impl VmtxMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for VmtxMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.top_side_bearings_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Vmtx<'_> {
|
||||
/// `vmtx`
|
||||
const TAG: Tag = Tag::new(b"vmtx");
|
@ -34,6 +34,12 @@ impl VorgMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for VorgMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.vert_origin_y_metrics_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Vorg<'_> {
|
||||
/// `VORG`
|
||||
const TAG: Tag = Tag::new(b"VORG");
|
@ -42,6 +42,12 @@ impl VvarMarker {
|
||||
}
|
||||
}
|
||||
|
||||
impl MinByteRange for VvarMarker {
|
||||
fn min_byte_range(&self) -> Range<usize> {
|
||||
0..self.v_org_mapping_offset_byte_range().end
|
||||
}
|
||||
}
|
||||
|
||||
impl TopLevelTable for Vvar<'_> {
|
||||
/// `VVAR`
|
||||
const TAG: Tag = Tag::new(b"VVAR");
|
@ -20,6 +20,9 @@ pub mod offsets_arrays {
|
||||
|
||||
include!("../generated/generated_test_offsets_arrays.rs");
|
||||
|
||||
#[cfg(test)]
|
||||
use font_test_data::bebuffer::BeBuffer;
|
||||
|
||||
pub struct VarSizeDummy<'a> {
|
||||
#[allow(dead_code)]
|
||||
count: u16,
|
||||
@ -43,7 +46,7 @@ pub mod offsets_arrays {
|
||||
|
||||
#[test]
|
||||
fn array_offsets() {
|
||||
let builder = crate::test_helpers::BeBuffer::new()
|
||||
let builder = BeBuffer::new()
|
||||
.push(MajorMinor::VERSION_1_0)
|
||||
.push(12_u16) // offset to 0xdead
|
||||
.push(0u16) // nullable
|
||||
@ -51,7 +54,7 @@ pub mod offsets_arrays {
|
||||
.push(12u16) // array offset
|
||||
.extend([0xdead_u16, 0xbeef]);
|
||||
|
||||
let table = KindsOfOffsets::read(builder.font_data()).unwrap();
|
||||
let table = KindsOfOffsets::read(builder.data().into()).unwrap();
|
||||
assert_eq!(table.nonnullable().unwrap().value(), 0xdead);
|
||||
|
||||
let array = table.array().unwrap();
|
||||
@ -60,17 +63,15 @@ pub mod offsets_arrays {
|
||||
|
||||
#[test]
|
||||
fn var_len_array_empty() {
|
||||
let builder = crate::test_helpers::BeBuffer::new()
|
||||
.push(0u16)
|
||||
.push(0xdeadbeef_u32);
|
||||
let builder = BeBuffer::new().push(0u16).push(0xdeadbeef_u32);
|
||||
|
||||
let table = VarLenHaver::read(builder.font_data()).unwrap();
|
||||
let table = VarLenHaver::read(builder.data().into()).unwrap();
|
||||
assert_eq!(table.other_field(), 0xdeadbeef);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn var_len_array_some() {
|
||||
let builder = crate::test_helpers::BeBuffer::new()
|
||||
let builder = BeBuffer::new()
|
||||
.push(3u16)
|
||||
.push(0u16) // first item in array is empty
|
||||
.push(2u16)
|
||||
@ -79,7 +80,7 @@ pub mod offsets_arrays {
|
||||
.extend([7u8, 7, 7, 7, 7])
|
||||
.push(0xdeadbeef_u32);
|
||||
|
||||
let table = VarLenHaver::read(builder.font_data()).unwrap();
|
||||
let table = VarLenHaver::read(builder.data().into()).unwrap();
|
||||
let kids = table
|
||||
.var_len()
|
||||
.iter()
|
||||
@ -94,7 +95,7 @@ pub mod offsets_arrays {
|
||||
#[test]
|
||||
#[cfg(feature = "experimental_traverse")]
|
||||
fn array_offsets_traverse() {
|
||||
let mut builder = crate::test_helpers::BeBuffer::new()
|
||||
let mut builder = BeBuffer::new()
|
||||
.push(MajorMinor::VERSION_1_1)
|
||||
.push(22_u16) // offset to [0xf00, 0xba4]
|
||||
.push(0u16) // nullable
|
||||
@ -116,7 +117,7 @@ pub mod offsets_arrays {
|
||||
.push(0xdead_beefu32)
|
||||
.extend([0xb01du16, 0xface]); // versioned nonnullable offset;
|
||||
|
||||
let table = KindsOfOffsets::read(builder.font_data()).unwrap();
|
||||
let table = KindsOfOffsets::read(builder.data().into()).unwrap();
|
||||
// traversal should not crash
|
||||
let _ = format!("{table:?}");
|
||||
assert_eq!(
|
||||
@ -187,55 +188,51 @@ pub mod count_all {
|
||||
}
|
||||
|
||||
pub mod conditions {
|
||||
#[cfg(test)]
|
||||
use font_test_data::bebuffer::BeBuffer;
|
||||
use font_types::MajorMinor;
|
||||
|
||||
include!("../generated/generated_test_conditions.rs");
|
||||
|
||||
#[test]
|
||||
fn majorminor_1() {
|
||||
let bytes = crate::test_helpers::BeBuffer::new()
|
||||
.push(MajorMinor::VERSION_1_0)
|
||||
.push(0u16);
|
||||
let table = MajorMinorVersion::read(bytes.font_data()).unwrap();
|
||||
let bytes = BeBuffer::new().push(MajorMinor::VERSION_1_0).push(0u16);
|
||||
let table = MajorMinorVersion::read(bytes.data().into()).unwrap();
|
||||
assert_eq!(table.always_present(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn majorminor_1_1() {
|
||||
let bytes = crate::test_helpers::BeBuffer::new()
|
||||
.push(MajorMinor::VERSION_1_1)
|
||||
.push(0u16);
|
||||
let bytes = BeBuffer::new().push(MajorMinor::VERSION_1_1).push(0u16);
|
||||
// shouldn't parse, we're missing a field
|
||||
assert!(MajorMinorVersion::read(bytes.font_data()).is_err());
|
||||
assert!(MajorMinorVersion::read(bytes.data().into()).is_err());
|
||||
|
||||
let bytes = crate::test_helpers::BeBuffer::new()
|
||||
let bytes = BeBuffer::new()
|
||||
.push(MajorMinor::VERSION_1_1)
|
||||
.push(0u16)
|
||||
.push(1u16);
|
||||
let table = MajorMinorVersion::read(bytes.font_data()).unwrap();
|
||||
let table = MajorMinorVersion::read(bytes.data().into()).unwrap();
|
||||
assert_eq!(table.if_11(), Some(1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn major_minor_2() {
|
||||
let bytes = crate::test_helpers::BeBuffer::new()
|
||||
.push(MajorMinor::VERSION_2_0)
|
||||
.push(0u16);
|
||||
let bytes = BeBuffer::new().push(MajorMinor::VERSION_2_0).push(0u16);
|
||||
// shouldn't parse, we're missing a field
|
||||
assert!(MajorMinorVersion::read(bytes.font_data()).is_err());
|
||||
assert!(MajorMinorVersion::read(bytes.data().into()).is_err());
|
||||
|
||||
let bytes = crate::test_helpers::BeBuffer::new()
|
||||
let bytes = BeBuffer::new()
|
||||
.push(MajorMinor::VERSION_2_0)
|
||||
.push(0u16)
|
||||
.push(2u32);
|
||||
let table = MajorMinorVersion::read(bytes.font_data()).unwrap();
|
||||
let table = MajorMinorVersion::read(bytes.data().into()).unwrap();
|
||||
assert_eq!(table.if_11(), None);
|
||||
assert_eq!(table.if_20(), Some(2));
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn make_flag_data(flags: GotFlags) -> crate::test_helpers::BeBuffer {
|
||||
let mut buf = crate::test_helpers::BeBuffer::new().push(42u16).push(flags);
|
||||
fn make_flag_data(flags: GotFlags) -> BeBuffer {
|
||||
let mut buf = BeBuffer::new().push(42u16).push(flags);
|
||||
if flags.contains(GotFlags::FOO) {
|
||||
buf = buf.push(0xf00_u16);
|
||||
}
|
||||
@ -251,7 +248,7 @@ pub mod conditions {
|
||||
#[test]
|
||||
fn flags_none() {
|
||||
let data = make_flag_data(GotFlags::empty());
|
||||
let table = FlagDay::read(data.font_data()).unwrap();
|
||||
let table = FlagDay::read(data.data().into()).unwrap();
|
||||
assert!(table.foo().is_none());
|
||||
assert!(table.bar().is_none());
|
||||
}
|
||||
@ -259,7 +256,7 @@ pub mod conditions {
|
||||
#[test]
|
||||
fn flags_foo() {
|
||||
let data = make_flag_data(GotFlags::FOO);
|
||||
let table = FlagDay::read(data.font_data()).unwrap();
|
||||
let table = FlagDay::read(data.data().into()).unwrap();
|
||||
assert_eq!(table.foo(), Some(0xf00));
|
||||
assert!(table.bar().is_none());
|
||||
assert_eq!(table.baz(), Some(0xba2));
|
||||
@ -268,7 +265,7 @@ pub mod conditions {
|
||||
#[test]
|
||||
fn flags_bar() {
|
||||
let data = make_flag_data(GotFlags::BAR);
|
||||
let table = FlagDay::read(data.font_data()).unwrap();
|
||||
let table = FlagDay::read(data.data().into()).unwrap();
|
||||
assert!(table.foo().is_none());
|
||||
assert_eq!(table.bar(), Some(0xba4));
|
||||
assert!(table.baz().is_none());
|
||||
@ -277,7 +274,7 @@ pub mod conditions {
|
||||
#[test]
|
||||
fn flags_baz() {
|
||||
let data = make_flag_data(GotFlags::BAZ);
|
||||
let table = FlagDay::read(data.font_data()).unwrap();
|
||||
let table = FlagDay::read(data.data().into()).unwrap();
|
||||
assert!(table.foo().is_none());
|
||||
assert!(table.bar().is_none());
|
||||
assert_eq!(table.baz(), Some(0xba2));
|
||||
@ -286,7 +283,7 @@ pub mod conditions {
|
||||
#[test]
|
||||
fn flags_foobar() {
|
||||
let data = make_flag_data(GotFlags::BAR | GotFlags::FOO);
|
||||
let table = FlagDay::read(data.font_data()).unwrap();
|
||||
let table = FlagDay::read(data.data().into()).unwrap();
|
||||
assert_eq!(table.foo(), Some(0xf00));
|
||||
assert_eq!(table.bar(), Some(0xba4));
|
||||
assert_eq!(table.baz(), Some(0xba2));
|
||||
@ -294,11 +291,9 @@ pub mod conditions {
|
||||
|
||||
#[test]
|
||||
fn fields_after_conditions_all_none() {
|
||||
let data = crate::test_helpers::BeBuffer::new()
|
||||
.push(GotFlags::empty())
|
||||
.extend([1u16, 2, 3]);
|
||||
let data = BeBuffer::new().push(GotFlags::empty()).extend([1u16, 2, 3]);
|
||||
|
||||
let table = FieldsAfterConditionals::read(data.font_data()).unwrap();
|
||||
let table = FieldsAfterConditionals::read(data.data().into()).unwrap();
|
||||
assert_eq!(table.always_here(), 1);
|
||||
assert_eq!(table.also_always_here(), 2);
|
||||
assert_eq!(table.and_me_too(), 3);
|
||||
@ -307,20 +302,18 @@ pub mod conditions {
|
||||
#[test]
|
||||
#[should_panic(expected = "OutOfBounds")]
|
||||
fn fields_after_conditions_wrong_len() {
|
||||
let data = crate::test_helpers::BeBuffer::new()
|
||||
.push(GotFlags::FOO)
|
||||
.extend([1u16, 2, 3]);
|
||||
let data = BeBuffer::new().push(GotFlags::FOO).extend([1u16, 2, 3]);
|
||||
|
||||
let _table = FieldsAfterConditionals::read(data.font_data()).unwrap();
|
||||
let _table = FieldsAfterConditionals::read(data.data().into()).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fields_after_conditionals_one_present() {
|
||||
let data = crate::test_helpers::BeBuffer::new()
|
||||
let data = BeBuffer::new()
|
||||
.push(GotFlags::BAR)
|
||||
.extend([1u16, 0xba4, 2, 3]);
|
||||
|
||||
let table = FieldsAfterConditionals::read(data.font_data()).unwrap();
|
||||
let table = FieldsAfterConditionals::read(data.data().into()).unwrap();
|
||||
assert_eq!(table.always_here(), 1);
|
||||
assert_eq!(table.bar(), Some(0xba4));
|
||||
assert_eq!(table.also_always_here(), 2);
|
||||
@ -330,11 +323,11 @@ pub mod conditions {
|
||||
|
||||
#[test]
|
||||
fn fields_after_conditions_all_present() {
|
||||
let data = crate::test_helpers::BeBuffer::new()
|
||||
let data = BeBuffer::new()
|
||||
.push(GotFlags::FOO | GotFlags::BAR | GotFlags::BAZ)
|
||||
.extend([0xf00u16, 1, 0xba4, 0xba2, 2, 3]);
|
||||
|
||||
let table = FieldsAfterConditionals::read(data.font_data()).unwrap();
|
||||
let table = FieldsAfterConditionals::read(data.data().into()).unwrap();
|
||||
assert_eq!(table.foo(), Some(0xf00));
|
||||
assert_eq!(table.always_here(), 1);
|
||||
assert_eq!(table.bar(), Some(0xba4));
|
@ -202,12 +202,12 @@ impl<'a> Cursor<'a> {
|
||||
#[allow(clippy::arithmetic_side_effects)] // these are all checked
|
||||
let result = match b0 {
|
||||
_ if b0 < 0x80 => b0,
|
||||
_ if b0 < 0xC0 => (b0 - 0x80) << 8 | next()?,
|
||||
_ if b0 < 0xE0 => (b0 - 0xC0) << 16 | next()? << 8 | next()?,
|
||||
_ if b0 < 0xF0 => (b0 - 0xE0) << 24 | next()? << 16 | next()? << 8 | next()?,
|
||||
_ if b0 < 0xC0 => ((b0 - 0x80) << 8) | next()?,
|
||||
_ if b0 < 0xE0 => ((b0 - 0xC0) << 16) | (next()? << 8) | next()?,
|
||||
_ if b0 < 0xF0 => ((b0 - 0xE0) << 24) | (next()? << 16) | (next()? << 8) | next()?,
|
||||
_ => {
|
||||
// TODO: << 32 doesn't make sense. (b0 - 0xF0) << 32
|
||||
next()? << 24 | next()? << 16 | next()? << 8 | next()?
|
||||
(next()? << 24) | (next()? << 16) | (next()? << 8) | next()?
|
||||
}
|
||||
};
|
||||
|
@ -85,17 +85,12 @@ pub mod traversal;
|
||||
#[cfg(any(test, feature = "codegen_test"))]
|
||||
pub mod codegen_test;
|
||||
|
||||
#[path = "tests/test_helpers.rs"]
|
||||
#[doc(hidden)]
|
||||
#[cfg(feature = "std")]
|
||||
pub mod test_helpers;
|
||||
|
||||
pub use font_data::FontData;
|
||||
pub use offset::{Offset, ResolveNullableOffset, ResolveOffset};
|
||||
pub use offset_array::{ArrayOfNullableOffsets, ArrayOfOffsets};
|
||||
pub use read::{ComputeSize, FontRead, FontReadWithArgs, ReadArgs, ReadError, VarSize};
|
||||
pub use table_provider::{TableProvider, TopLevelTable};
|
||||
pub use table_ref::TableRef;
|
||||
pub use table_ref::{MinByteRange, TableRef};
|
||||
|
||||
/// Public re-export of the font-types crate.
|
||||
pub extern crate font_types as types;
|
||||
@ -112,7 +107,7 @@ pub(crate) mod codegen_prelude {
|
||||
ComputeSize, FontRead, FontReadWithArgs, Format, ReadArgs, ReadError, VarSize,
|
||||
};
|
||||
pub use crate::table_provider::TopLevelTable;
|
||||
pub use crate::table_ref::TableRef;
|
||||
pub use crate::table_ref::{MinByteRange, TableRef};
|
||||
pub use std::ops::Range;
|
||||
|
||||
pub use types::*;
|
@ -43,7 +43,7 @@ pub trait TableProvider<'a> {
|
||||
fn hmtx(&self) -> Result<tables::hmtx::Hmtx<'a>, ReadError> {
|
||||
//FIXME: should we make the user pass these in?
|
||||
let num_glyphs = self.maxp().map(|maxp| maxp.num_glyphs())?;
|
||||
let number_of_h_metrics = self.hhea().map(|hhea| hhea.number_of_long_metrics())?;
|
||||
let number_of_h_metrics = self.hhea().map(|hhea| hhea.number_of_h_metrics())?;
|
||||
let data = self.expect_data_for_tag(tables::hmtx::Hmtx::TAG)?;
|
||||
tables::hmtx::Hmtx::read(data, number_of_h_metrics, num_glyphs)
|
||||
}
|
||||
@ -223,6 +223,10 @@ pub trait TableProvider<'a> {
|
||||
fn meta(&self) -> Result<tables::meta::Meta<'a>, ReadError> {
|
||||
self.expect_table()
|
||||
}
|
||||
|
||||
fn base(&self) -> Result<tables::base::Base<'a>, ReadError> {
|
||||
self.expect_table()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@ -267,7 +271,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
let number_of_h_metrics = DummyProvider.hhea().unwrap().number_of_long_metrics();
|
||||
let number_of_h_metrics = DummyProvider.hhea().unwrap().number_of_h_metrics();
|
||||
let num_glyphs = DummyProvider.maxp().unwrap().num_glyphs();
|
||||
let hmtx = DummyProvider.hmtx().unwrap();
|
||||
|
@ -5,6 +5,13 @@ use crate::{
|
||||
font_data::FontData,
|
||||
offset::{Offset, ResolveOffset},
|
||||
};
|
||||
use std::ops::Range;
|
||||
/// Return the minimum range of the table bytes
|
||||
///
|
||||
/// This trait is implemented in generated code, and we use this to get the minimum length/bytes of a table
|
||||
pub trait MinByteRange {
|
||||
fn min_byte_range(&self) -> Range<usize>;
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
/// Typed access to raw table data.
|
||||
@ -40,3 +47,18 @@ impl<'a, T> TableRef<'a, T> {
|
||||
impl<U, T: Format<U>> Format<U> for TableRef<'_, T> {
|
||||
const FORMAT: U = T::FORMAT;
|
||||
}
|
||||
|
||||
impl<'a, T: MinByteRange> TableRef<'a, T> {
|
||||
/// Return the minimum byte range of this table
|
||||
pub fn min_byte_range(&self) -> Range<usize> {
|
||||
self.shape.min_byte_range()
|
||||
}
|
||||
|
||||
/// Return the minimum bytes of this table
|
||||
pub fn min_table_bytes(&self) -> &'a [u8] {
|
||||
self.offset_data()
|
||||
.as_bytes()
|
||||
.get(self.shape.min_byte_range())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
}
|
@ -437,7 +437,7 @@ pub type ExtendedStateTableU16<'a> = ExtendedStateTable<'a, u16>;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::test_helpers::BeBuffer;
|
||||
use font_test_data::bebuffer::BeBuffer;
|
||||
|
||||
use super::*;
|
||||
|
||||
@ -450,7 +450,7 @@ mod tests {
|
||||
];
|
||||
let mut buf = BeBuffer::new();
|
||||
buf = buf.extend(words);
|
||||
let lookup = LookupU16::read(buf.font_data()).unwrap();
|
||||
let lookup = LookupU16::read(buf.data().into()).unwrap();
|
||||
for gid in 0..=8 {
|
||||
assert_eq!(lookup.value(gid).unwrap(), gid * 2);
|
||||
}
|
||||
@ -474,7 +474,7 @@ mod tests {
|
||||
];
|
||||
let mut buf = BeBuffer::new();
|
||||
buf = buf.extend(words);
|
||||
let lookup = LookupU16::read(buf.font_data()).unwrap();
|
||||
let lookup = LookupU16::read(buf.data().into()).unwrap();
|
||||
let expected = [(20..=22, 4), (23..=24, 5), (25..=28, 6)];
|
||||
for (range, class) in expected {
|
||||
for gid in range {
|
||||
@ -506,7 +506,7 @@ mod tests {
|
||||
];
|
||||
let mut buf = BeBuffer::new();
|
||||
buf = buf.extend(words);
|
||||
let lookup = LookupU16::read(buf.font_data()).unwrap();
|
||||
let lookup = LookupU16::read(buf.data().into()).unwrap();
|
||||
let expected = [
|
||||
(20, 3),
|
||||
(21, 2),
|
||||
@ -544,7 +544,7 @@ mod tests {
|
||||
];
|
||||
let mut buf = BeBuffer::new();
|
||||
buf = buf.extend(words);
|
||||
let lookup = LookupU16::read(buf.font_data()).unwrap();
|
||||
let lookup = LookupU16::read(buf.data().into()).unwrap();
|
||||
let expected = [(50, 600), (51, 601), (201, 602), (202, 900)];
|
||||
for (in_glyph, out_glyph) in expected {
|
||||
assert_eq!(lookup.value(in_glyph).unwrap(), out_glyph);
|
||||
@ -565,7 +565,7 @@ mod tests {
|
||||
];
|
||||
let mut buf = BeBuffer::new();
|
||||
buf = buf.extend(words);
|
||||
let lookup = LookupU16::read(buf.font_data()).unwrap();
|
||||
let lookup = LookupU16::read(buf.data().into()).unwrap();
|
||||
let expected = &words[3..];
|
||||
for (gid, expected) in (201..209).zip(expected) {
|
||||
assert_eq!(lookup.value(gid).unwrap(), *expected);
|
||||
@ -588,7 +588,7 @@ mod tests {
|
||||
let mapped = [3_u32, 8, 2902384, 9, 1, u32::MAX, 60];
|
||||
let mut buf = BeBuffer::new();
|
||||
buf = buf.extend(words).extend(mapped);
|
||||
let lookup = LookupU32::read(buf.font_data()).unwrap();
|
||||
let lookup = LookupU32::read(buf.data().into()).unwrap();
|
||||
for (gid, expected) in (201..209).zip(mapped) {
|
||||
assert_eq!(lookup.value(gid).unwrap(), expected);
|
||||
}
|
||||
@ -639,7 +639,7 @@ mod tests {
|
||||
.extend(class_table)
|
||||
.extend(state_array)
|
||||
.extend(entry_table);
|
||||
let table = ExtendedStateTable::<ContextualData>::read(buf.font_data()).unwrap();
|
||||
let table = ExtendedStateTable::<ContextualData>::read(buf.data().into()).unwrap();
|
||||
// check class lookups
|
||||
let [class_50, class_80, class_201] =
|
||||
[50, 80, 201].map(|gid| table.class(GlyphId16::from(gid)).unwrap());
|
||||
@ -712,7 +712,7 @@ mod tests {
|
||||
.extend(classes)
|
||||
.extend(state_array)
|
||||
.extend(entry_table);
|
||||
let table = StateTable::read(buf.font_data()).unwrap();
|
||||
let table = StateTable::read(buf.data().into()).unwrap();
|
||||
// check class lookups
|
||||
for i in 0..4u8 {
|
||||
assert_eq!(table.class(GlyphId16::from(i as u16 + 3)).unwrap(), i + 1);
|
@ -22,8 +22,9 @@ impl<'a> Ankr<'a> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use font_test_data::bebuffer::BeBuffer;
|
||||
|
||||
use super::*;
|
||||
use crate::test_helpers::BeBuffer;
|
||||
|
||||
#[test]
|
||||
fn anchor_points() {
|
||||
@ -51,7 +52,7 @@ mod tests {
|
||||
.push(entry.len() as u32)
|
||||
.extend(entry.iter().flat_map(|x| [x.0, x.1]));
|
||||
}
|
||||
let ankr = Ankr::read(buf.font_data()).unwrap();
|
||||
let ankr = Ankr::read(buf.data().into()).unwrap();
|
||||
let anchor_points = (0..4)
|
||||
.map(|gid| {
|
||||
let points = ankr.anchor_points(GlyphId::new(gid)).unwrap();
|
@ -59,8 +59,10 @@ impl<'a> FontRead<'a> for SegmentMaps<'a> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use font_test_data::bebuffer::BeBuffer;
|
||||
|
||||
use super::*;
|
||||
use crate::{test_helpers, FontRef, TableProvider};
|
||||
use crate::{FontRef, TableProvider};
|
||||
|
||||
fn value_map(from: f32, to: f32) -> [F2Dot14; 2] {
|
||||
[F2Dot14::from_f32(from), F2Dot14::from_f32(to)]
|
||||
@ -100,8 +102,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn segment_maps_multi_axis() {
|
||||
use test_helpers::BeBuffer;
|
||||
|
||||
let segment_one_maps = [
|
||||
value_map(-1.0, -1.0),
|
||||
value_map(-0.6667, -0.5),
|
||||
@ -123,7 +123,7 @@ mod tests {
|
||||
.extend(segment_two_maps[0])
|
||||
.extend(segment_two_maps[1]);
|
||||
|
||||
let avar = super::Avar::read(data.font_data()).unwrap();
|
||||
let avar = super::Avar::read(data.data().into()).unwrap();
|
||||
assert_eq!(avar.axis_segment_maps().iter().count(), 2);
|
||||
assert_eq!(
|
||||
avar.axis_segment_maps()
|
@ -6,10 +6,10 @@ include!("../../generated/generated_base.rs");
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use font_test_data::bebuffer::BeBuffer;
|
||||
use font_types::MajorMinor;
|
||||
|
||||
use super::*;
|
||||
use crate::test_helpers::BeBuffer;
|
||||
|
||||
#[test]
|
||||
/// https://learn.microsoft.com/en-us/typography/opentype/spec/base#base-table-examples
|
||||
@ -37,7 +37,7 @@ mod tests {
|
||||
.push(Tag::new(b"latn"))
|
||||
.push(0xb4_u16);
|
||||
|
||||
let base = Base::read(data.font_data()).unwrap();
|
||||
let base = Base::read(data.data().into()).unwrap();
|
||||
assert_eq!(base.version(), MajorMinor::VERSION_1_0);
|
||||
let horiz = base.horiz_axis().unwrap().unwrap();
|
||||
let base_tag = horiz.base_tag_list().unwrap().unwrap();
|
||||
@ -45,6 +45,7 @@ mod tests {
|
||||
base_tag.baseline_tags(),
|
||||
&[Tag::new(b"hang"), Tag::new(b"ideo"), Tag::new(b"romn")]
|
||||
);
|
||||
assert_eq!(base_tag.min_byte_range().end, 14);
|
||||
let base_script = horiz.base_script_list().unwrap();
|
||||
assert_eq!(
|
||||
base_script.base_script_records()[3].base_script_tag(),
|
@ -18,19 +18,20 @@ impl BitmapSize {
|
||||
if !(self.start_glyph_index()..=self.end_glyph_index()).contains(&glyph_id) {
|
||||
return Err(ReadError::OutOfBounds);
|
||||
}
|
||||
let subtable_list = self.index_subtable_list(offset_data)?;
|
||||
let mut location = BitmapLocation {
|
||||
bit_depth: self.bit_depth,
|
||||
..BitmapLocation::default()
|
||||
};
|
||||
for ix in 0..self.number_of_index_subtables() {
|
||||
let subtable = self.subtable(offset_data, ix)?;
|
||||
if !(subtable.first_glyph_index..=subtable.last_glyph_index).contains(&glyph_id) {
|
||||
for record in subtable_list.index_subtable_records() {
|
||||
let subtable = record.index_subtable(subtable_list.offset_data())?;
|
||||
if !(record.first_glyph_index()..=record.last_glyph_index()).contains(&glyph_id) {
|
||||
continue;
|
||||
}
|
||||
// glyph index relative to the first glyph in the subtable
|
||||
let glyph_ix =
|
||||
glyph_id.to_u32() as usize - subtable.first_glyph_index.to_u32() as usize;
|
||||
match &subtable.kind {
|
||||
glyph_id.to_u32() as usize - record.first_glyph_index().to_u32() as usize;
|
||||
match &subtable {
|
||||
IndexSubtable::Format1(st) => {
|
||||
location.format = st.image_format();
|
||||
let start = st.image_data_offset() as usize
|
||||
@ -114,37 +115,25 @@ impl BitmapSize {
|
||||
Err(ReadError::OutOfBounds)
|
||||
}
|
||||
|
||||
fn subtable<'a>(
|
||||
/// Returns the [IndexSubtableList] associated with this size.
|
||||
///
|
||||
/// The `offset_data` parameter is provided by the `offset_data()` method
|
||||
/// of the parent `Eblc` or `Cblc` table.
|
||||
pub fn index_subtable_list<'a>(
|
||||
&self,
|
||||
offset_data: FontData<'a>,
|
||||
index: u32,
|
||||
) -> Result<BitmapSizeSubtable<'a>, ReadError> {
|
||||
let base_offset = self.index_subtable_array_offset() as usize;
|
||||
const SUBTABLE_HEADER_SIZE: usize = 8;
|
||||
let header_offset = base_offset + index as usize * SUBTABLE_HEADER_SIZE;
|
||||
let header_data = offset_data
|
||||
.slice(header_offset..)
|
||||
) -> Result<IndexSubtableList<'a>, ReadError> {
|
||||
let start = self.index_subtable_list_offset() as usize;
|
||||
let end = start
|
||||
.checked_add(self.index_subtable_list_size() as usize)
|
||||
.ok_or(ReadError::OutOfBounds)?;
|
||||
let header = IndexSubtableArray::read(header_data)?;
|
||||
let subtable_offset = base_offset + header.additional_offset_to_index_subtable() as usize;
|
||||
let subtable_data = offset_data
|
||||
.slice(subtable_offset..)
|
||||
let data = offset_data
|
||||
.slice(start..end)
|
||||
.ok_or(ReadError::OutOfBounds)?;
|
||||
let subtable = IndexSubtable::read(subtable_data)?;
|
||||
Ok(BitmapSizeSubtable {
|
||||
first_glyph_index: header.first_glyph_index(),
|
||||
last_glyph_index: header.last_glyph_index(),
|
||||
kind: subtable,
|
||||
})
|
||||
IndexSubtableList::read(data, self.number_of_index_subtables())
|
||||
}
|
||||
}
|
||||
|
||||
struct BitmapSizeSubtable<'a> {
|
||||
pub first_glyph_index: GlyphId16,
|
||||
pub last_glyph_index: GlyphId16,
|
||||
pub kind: IndexSubtable<'a>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct BitmapLocation {
|
||||
/// Format of EBDT/CBDT image data.
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user