Skip to content

Commit

Permalink
Merge pull request #1339 from googlefonts/null-tag
Browse files Browse the repository at this point in the history
[types] Add Tag::NULL associated constant
  • Loading branch information
anthrotype authored Feb 4, 2025
2 parents 8eca823 + f9a560d commit ee7faf6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions font-types/src/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ use std::{
pub struct Tag([u8; 4]);

impl Tag {
/// A 'null' tag consists of four spaces.
///
/// This tag is not a valid identifier, but can be used to represent the
/// absence of a tag. See the comments on the [OS/2 `achVendID`][achVendID]
/// field.
///
/// [achVendID]: https://learn.microsoft.com/en-us/typography/opentype/spec/os2#achvendid
pub const NULL: Self = Tag::new(&[0x20; 4]);

/// Construct a `Tag` from raw bytes.
///
/// This does not perform any validation; use [`Tag::new_checked`] for a
Expand Down Expand Up @@ -234,10 +243,9 @@ impl Debug for Tag {
}
}

// a meaningless placeholder value.
impl Default for Tag {
fn default() -> Self {
Tag([b' '; 4])
Tag::NULL
}
}

Expand Down

0 comments on commit ee7faf6

Please sign in to comment.