linebender_resource_handle/font.rs
1// Copyright 2022 the Raw Resource Handle Authors
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4use crate::Blob;
5
6/// Owned shareable font resource.
7#[derive(Clone, PartialEq, Debug)]
8pub struct FontData {
9 /// Blob containing the content of the font file.
10 pub data: Blob<u8>,
11 /// Index of the font in a collection, or 0 for a single font.
12 pub index: u32,
13}
14
15impl FontData {
16 /// Creates a new font with the given data and collection index.
17 #[must_use]
18 pub fn new(data: Blob<u8>, index: u32) -> Self {
19 Self { data, index }
20 }
21}