Skip to content

Commit 6143ce1

Browse files
author
bors-servo
authored
Auto merge of #336 - wezm:copy-available-tables, r=jdm
Add get_available_font_tables to CTFont The PR exposes `CTFontCopyAvailableTables` through `get_available_font_tables`. <!-- 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-foundation-rs/336) <!-- Reviewable:end -->
2 parents ba4e7f4 + bc20614 commit 6143ce1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

core-text/src/font.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,17 @@ impl CTFont {
346346
}
347347
}
348348

349+
pub fn get_available_font_tables(&self) -> Option<CFArray<CTFontTableTag>> {
350+
unsafe {
351+
let result = CTFontCopyAvailableTables(self.0, kCTFontTableOptionsExcludeSynthetic);
352+
if result.is_null() {
353+
None
354+
} else {
355+
Some(TCFType::wrap_under_create_rule(result))
356+
}
357+
}
358+
}
359+
349360
pub fn get_bounding_rects_for_glyphs(&self, orientation: CTFontOrientation, glyphs: &[CGGlyph])
350361
-> CGRect {
351362
unsafe {
@@ -612,7 +623,7 @@ extern {
612623
//fn CTFontCreateWithQuickdrawInstance
613624

614625
/* Getting Font Table Data */
615-
//fn CTFontCopyAvailableTables(font: CTFontRef, options: CTFontTableOptions) -> CFArrayRef;
626+
fn CTFontCopyAvailableTables(font: CTFontRef, options: CTFontTableOptions) -> CFArrayRef;
616627
fn CTFontCopyTable(font: CTFontRef, table: CTFontTableTag, options: CTFontTableOptions) -> CFDataRef;
617628

618629
fn CTFontGetTypeID() -> CFTypeID;

0 commit comments

Comments
 (0)