Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Make CTFontDescriptor::font_path() return filesystem path, not URL #85

Merged
merged 1 commit into from
Jan 31, 2018

Conversation

poiru
Copy link
Contributor

@poiru poiru commented Jan 30, 2018

Prior to this commit, the return string was in the format
file:///foo/bar.otf. We now omit the leading file:// portion. This
also properly retains characters that are not URL safe.


This change is Reviewable

Prior to this commit, the return string was in the format
`file:///foo/bar.otf`. We now omit the leading `file://` portion. This
also properly retains characters that are not URL safe.
@poiru
Copy link
Contributor Author

poiru commented Jan 30, 2018

@jdm I closed this earlier (#81), but on further thought, what do you think about merging this? Unlike #78, I don't really consider this to be a breaking change; the current function is arguably broken.

@@ -250,7 +250,11 @@ impl CTFontDescriptor {
let value = CFType::wrap_under_create_rule(value);
assert!(value.instance_of::<CFURL>());
let url = CFURL::wrap_under_get_rule(mem::transmute(value.as_CFTypeRef()));
Some(format!("{:?}", url))
let path = CFString::wrap_under_create_rule(CFURLCopyFileSystemPath(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we made this return Option<PathBuf> and called url.to_path() instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, deja vu. I understand better now.

@jdm
Copy link
Member

jdm commented Jan 31, 2018

@bors-servo r+

@bors-servo
Copy link

📌 Commit 8bc5c45 has been approved by jdm

@bors-servo
Copy link

⌛ Testing commit 8bc5c45 with merge 4de73f4...

bors-servo pushed a commit that referenced this pull request Jan 31, 2018
Make CTFontDescriptor::font_path() return filesystem path, not URL

Prior to this commit, the return string was in the format
`file:///foo/bar.otf`. We now omit the leading `file://` portion. This
also properly retains characters that are not URL safe.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-text-rs/85)
<!-- Reviewable:end -->
@bors-servo
Copy link

💔 Test failed - status-travis

@poiru
Copy link
Contributor Author

poiru commented Jan 31, 2018

@bors-servo retry

Can I do this? Guess not!

@bors-servo
Copy link

@poiru: 🔑 Insufficient privileges: and not in try users

1 similar comment
@bors-servo
Copy link

@poiru: 🔑 Insufficient privileges: and not in try users

@jdm
Copy link
Member

jdm commented Jan 31, 2018

@bors-servo retry

@bors-servo
Copy link

⌛ Testing commit 8bc5c45 with merge b665662...

bors-servo pushed a commit that referenced this pull request Jan 31, 2018
Make CTFontDescriptor::font_path() return filesystem path, not URL

Prior to this commit, the return string was in the format
`file:///foo/bar.otf`. We now omit the leading `file://` portion. This
also properly retains characters that are not URL safe.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-text-rs/85)
<!-- Reviewable:end -->
@bors-servo
Copy link

☀️ Test successful - status-travis
Approved by: jdm
Pushing b665662 to master...

@bors-servo bors-servo merged commit 8bc5c45 into servo:master Jan 31, 2018
@poiru poiru deleted the fix-font-path branch January 31, 2018 16:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants