Conversation
Signed-off-by: Nico Burns <nico@nicoburns.com>
dfrg
left a comment
There was a problem hiding this comment.
LGTM with a couple changes requested.
| Self::from_be_bytes(src.to_be_bytes()) | ||
| } | ||
|
|
||
| /// Convert a `Tag` into a big-endian `u32` |
There was a problem hiding this comment.
| /// Convert a `Tag` into a big-endian `u32` | |
| /// Convert a `Tag` into a big-endian `u32`. |
| /// | ||
| /// This is provided as a convenience method for interop with code that | ||
| /// stores tags as big-endian u32s. | ||
| pub const fn into_u32(self) -> u32 { |
There was a problem hiding this comment.
I know a conversion consuming self should have an into_ prefix but the vast majority of the methods in this crate use to_ so I'd prefer to_u32 here for consistency.
|
Holding off on this until I can determine whether there a consistent byte order used to represent opentype tags as u32. It is looking possible that macOS and Windows both use u32 but with swapped byte order. |
Please add one that reads it as big-endian, like the rest of the most of the font. I think you are right that Windows uses the opposite order. |
Motivation is exactly the same as the
from_u32method: it allows interop with systems that represent tag in this format (HarfBuzz, CoreText, etc).