Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support serialization to NativeFontHandle #1133

Merged
merged 1 commit into from Apr 20, 2017

Conversation

@alfredoyang
Copy link
Contributor

alfredoyang commented Apr 18, 2017

NativeFontHandle needs to implement serialization due to it is removed from CGFont in core-graphics.

servo/servo#15607

This PR depends on servo/core-graphics-rs#82.


This change is Reviewable

@alfredoyang
Copy link
Contributor Author

alfredoyang commented Apr 18, 2017

The failure is due to it requires servo/core-graphics-rs#82.

@alfredoyang alfredoyang mentioned this pull request Apr 18, 2017
4 of 4 tasks complete
Copy link
Member

kvark left a comment

Thank you!
PR looks good to me, minus a few nits. I restarted Travis to see if the build has improved.

@@ -13,6 +13,7 @@ webgl = ["offscreen_gl_context"]
[dependencies]
app_units = "0.4"
byteorder = "1.0"
core-foundation = "0.3"

This comment has been minimized.

@kvark

kvark Apr 18, 2017

Member

we could make it an OSX only dependency (via [target.'cfg(osx)'.dependencies])

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer {
let postscript_name: String = try!(Deserialize::deserialize(deserializer));
CGFont::from_name(&CFString::new(&*postscript_name))
.map(|font| NativeFontHandle(font))

This comment has been minimized.

@kvark

kvark Apr 18, 2017

Member

this could look cleaner with a simple match instead of map+map_err pair

@alfredoyang
Copy link
Contributor Author

alfredoyang commented Apr 19, 2017

hmm...
It looks like I forgot to add #[cfg(target_os = "macos")] before
impl Deserialize for NativeFontHandle.

@alfredoyang
Copy link
Contributor Author

alfredoyang commented Apr 19, 2017

Review status: 0 of 4 files reviewed at latest revision, 2 unresolved discussions.


webrender_traits/Cargo.toml, line 16 at r1 (raw file):

Previously, kvark (Dzmitry Malyshau) wrote…

we could make it an OSX only dependency (via [target.'cfg(osx)'.dependencies])

Fixed.


webrender_traits/src/font.rs, line 32 at r1 (raw file):

Previously, kvark (Dzmitry Malyshau) wrote…

this could look cleaner with a simple match instead of map+map_err pair

Fixed.


Comments from Reviewable

@kvark
Copy link
Member

kvark commented Apr 19, 2017

Thanks @alfredoyang ! Do you mind squashing the commits before we merge?

@alfredoyang
Copy link
Contributor Author

alfredoyang commented Apr 19, 2017

Please squash them. Btw, I can git --amend next time if it is the preferred way.

@KiChjang
Copy link
Member

KiChjang commented Apr 19, 2017

@alfredoyang I think @kvark meant whether you mind squashing your own commits, before the PR is merged.

@alfredoyang alfredoyang force-pushed the alfredoyang:add_gc_font_serialization branch from 68a66cf to e83ff76 Apr 20, 2017
@alfredoyang
Copy link
Contributor Author

alfredoyang commented Apr 20, 2017

Ok, it's done.

@kvark
Copy link
Member

kvark commented Apr 20, 2017

Thank you!
@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Apr 20, 2017

📌 Commit e83ff76 has been approved by kvark

@bors-servo
Copy link
Contributor

bors-servo commented Apr 20, 2017

Testing commit e83ff76 with merge f3fa348...

bors-servo added a commit that referenced this pull request Apr 20, 2017
Support serialization to NativeFontHandle

NativeFontHandle needs to implement serialization due to it is removed from ```CGFont``` in ```core-graphics```.

servo/servo#15607

This PR depends on servo/core-graphics-rs#82.

<!-- 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/1133)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Apr 20, 2017

☀️ Test successful - status-travis
Approved by: kvark
Pushing f3fa348 to master...

@bors-servo bors-servo merged commit e83ff76 into servo:master Apr 20, 2017
3 of 4 checks passed
3 of 4 checks passed
code-review/reviewable 4 files, 2 discussions left (kvark)
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
bors-servo added a commit to servo/servo that referenced this pull request May 2, 2017
Use NativeFontHandle instead of CGFont

<!-- Please describe your changes on the following line: -->
```serde``` is removed from ```core-graphics```, ```NativeFontHandle``` implements serialization and we should use ```NativeFontHandle``` instead of ```CGFont```.

This PR depends on followings.
servo/core-graphics-rs#82
servo/webrender#1133

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X]  These changes fix #15607 (github issue number if applicable).

<!-- Either: -->
- [X] These changes do not require tests according to issue comment.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16512)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.