mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Auto merge of #21365 - jdm:android-font, r=mbrubeck
Avoid crash using freetype in debug android builds - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #21327 - [x] These changes do not require tests because this code is only executed in debug builds <!-- 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/21365) <!-- Reviewable:end -->
This commit is contained in:
commit
8a691f74e7
4 changed files with 14 additions and 8 deletions
|
@ -56,7 +56,7 @@ pub trait FontHandleMethods: Sized {
|
||||||
) -> Result<Self, ()>;
|
) -> Result<Self, ()>;
|
||||||
|
|
||||||
fn template(&self) -> Arc<FontTemplateData>;
|
fn template(&self) -> Arc<FontTemplateData>;
|
||||||
fn family_name(&self) -> String;
|
fn family_name(&self) -> Option<String>;
|
||||||
fn face_name(&self) -> Option<String>;
|
fn face_name(&self) -> Option<String>;
|
||||||
|
|
||||||
fn style(&self) -> font_style::T;
|
fn style(&self) -> font_style::T;
|
||||||
|
@ -289,7 +289,8 @@ impl Font {
|
||||||
|
|
||||||
debug!("{} font table[{}] with family={}, face={}",
|
debug!("{} font table[{}] with family={}, face={}",
|
||||||
status, tag.tag_to_str(),
|
status, tag.tag_to_str(),
|
||||||
self.handle.family_name(), self.handle.face_name().unwrap_or("unavailable".to_owned()));
|
self.handle.family_name().unwrap_or("unavailable".to_owned()),
|
||||||
|
self.handle.face_name().unwrap_or("unavailable".to_owned()));
|
||||||
|
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,9 +148,14 @@ impl FontHandleMethods for FontHandle {
|
||||||
self.font_data.clone()
|
self.font_data.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn family_name(&self) -> String {
|
fn family_name(&self) -> Option<String> {
|
||||||
unsafe {
|
unsafe {
|
||||||
c_str_to_string((*self.face).family_name as *const c_char)
|
let family_name = (*self.face).family_name;
|
||||||
|
if !family_name.is_null() {
|
||||||
|
Some(c_str_to_string(family_name as *const c_char))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,8 +195,8 @@ impl FontHandleMethods for FontHandle {
|
||||||
self.font_data.clone()
|
self.font_data.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn family_name(&self) -> String {
|
fn family_name(&self) -> Option<String> {
|
||||||
self.ctfont.family_name()
|
Some(self.ctfont.family_name())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn face_name(&self) -> Option<String> {
|
fn face_name(&self) -> Option<String> {
|
||||||
|
|
|
@ -294,8 +294,8 @@ impl FontHandleMethods for FontHandle {
|
||||||
self.font_data.clone()
|
self.font_data.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn family_name(&self) -> String {
|
fn family_name(&self) -> Option<String> {
|
||||||
self.info.family_name.clone()
|
Some(self.info.family_name.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn face_name(&self) -> Option<String> {
|
fn face_name(&self) -> Option<String> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue