Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport serializing NativeFontHandle on macOS #2122
Conversation
|
|
|
Looks like CI failures on Windows at least? |
|
|
52d09ae
to
9517fe9
|
I just realized this ends up writing out a new font every time it's used |
c04fb74
to
0cc1218
|
@jrmuizel Is this ready for review now? |
|
Yes. |
| fn calc_table_checksum<D: Read>(mut data: D) -> u32 { | ||
| let mut sum: u32 = 0; | ||
| loop { | ||
| if let Ok(x) = data.read_u32::<BigEndian>() { |
This comment has been minimized.
This comment has been minimized.
| } | ||
|
|
||
| fn max_pow_2_less_than(a: u16) -> u16 | ||
| { |
This comment has been minimized.
This comment has been minimized.
| while (x << (shift + 1)) < a { | ||
| shift += 1; | ||
| } | ||
| return shift; |
This comment has been minimized.
This comment has been minimized.
| offset += 4 * 3; | ||
| offset += 4 * 4 * (count as u32); | ||
| for tag in tags.iter() { | ||
| if tag == 0x43464620 { // 'CFF ' |
This comment has been minimized.
This comment has been minimized.
| @@ -217,25 +217,49 @@ fn write_sc(parent: &mut Table, sc: &StackingContext, properties: &SceneProperti | |||
| } | |||
|
|
|||
| #[cfg(target_os = "windows")] | |||
| fn native_font_handle_to_yaml(handle: &NativeFontHandle, parent: &mut yaml_rust::yaml::Hash) { | |||
| fn native_font_handle_to_yaml(_rsrc: &mut ResourceGenerator, | |||
| handle: &NativeFontHandle, | |||
This comment has been minimized.
This comment has been minimized.
| handle: &NativeFontHandle, | ||
| parent: &mut yaml_rust::yaml::Hash, | ||
| path_opt: &mut Option<PathBuf>) { | ||
| let path = if let &mut Some(ref path) = path_opt { |
This comment has been minimized.
This comment has been minimized.
| } | ||
|
|
||
| impl ResourceGenerator { | ||
| fn next_rsrc_paths(&mut self, base: &str, ext: &str, ) -> (PathBuf, PathBuf) { |
This comment has been minimized.
This comment has been minimized.
This cleans up things a little and will make it easier for us to generate files for native fonts because we won't have multiple mutable borrows on YamlFrameWriter.
This ups the core-graphics dependency and adds the ability to convert a CGFont into a font file. The code is based on the code in https://searchfox.org/mozilla-central/rev/7a8c667bdd2a4a32746c9862356e199627c0896d/gfx/2d/ScaledFontMac.cpp#255 We also switch to CFNumber::from to avoid breakage with the latest core-foundation
|
I'm just going to assume that the code in @bors-servo r+ |
|
|
Support serializing NativeFontHandle on macOS This fixes #2051 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2122) <!-- Reviewable:end -->
|
|
Force corefoundation 0.4.6 or higher since we use CFNumber::from whic… …h didn't exist in 0.4.4 The use of CFNumber::from was added in #2122 and caused downstream gecko bustage since gecko is still using 0.4.4 in its Cargo.lock file. This change will force gecko to update to 0.4.6. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2190) <!-- Reviewable:end -->
jrmuizel commentedNov 28, 2017
•
edited by larsbergstrom
This fixes #2051
This change is