Commit Graph

57 Commits

Author SHA1 Message Date
michaelwright235 b742606a5c sys: string: Remove repeating type
Removes `UniChar` type because it's already defined in base.rs.
2023-06-01 15:50:12 +03:00
ssssota b0e0dd8bf4 Add get name function 2022-02-16 12:09:01 +09:00
Jeff Muizelaar aee417874f Expose bindings to CTFontCreateUIFontForLanguage 2021-12-13 12:42:52 -05:00
Jeff Muizelaar 5dff9e13fd Add some more tests around system fonts and variations 2021-12-08 20:23:44 -05:00
Jeff Muizelaar 77ffcfe731 core-text: out_of_range_variations: Add support for macOS 12 2021-12-08 19:02:22 -05:00
Jeff Muizelaar 3d6c103a14 core-text: Add a test for out of range variations. 2021-12-08 14:53:53 -05:00
Jeff Muizelaar 1ad12536ec Test that we can create a new CTFont from the descriptor attributes. 2021-11-22 19:22:41 -05:00
Jeff Muizelaar 39956a4d8e Add some documentation about using an autorelease pool 2020-12-22 21:13:41 -05:00
bors-servo 7a2ec12906 Auto merge of #421 - jrmuizel:copy-system, r=jdm
Test that copying system fonts doesn't change the url
2020-11-19 10:42:26 -05:00
Jeff Muizelaar 11247e3e8d Test that copying system fonts doesn't change the url 2020-11-04 09:11:49 -05:00
Jeff Muizelaar 0f3eaa7416 Add create_font_descriptor_with_data
This allows create a font from a CFData instead of slice.
More importantly this allows using a CFData that was created
with a custom allocator.
2020-11-03 10:58:40 -05:00
Jeff Muizelaar 597a12983a Make CTFontDescriptor Send and Sync and expose attributes() 2020-10-28 12:13:03 -04:00
Jeff Muizelaar 5a9ab37c01 Make sure we can round trip data fonts through descriptors. 2020-10-26 14:46:13 -04:00
Jeff Muizelaar f8b2abf407 Expose CTFontDescriptorCreateCopyWithAttributes 2020-10-21 11:34:27 -04:00
Josh Matthews d3336c3a21 Version bumps for cocoa, core-foundation-sys, core-foundation, core-text, core-graphics-types, core-graphics. 2020-09-15 12:19:56 -04:00
Wang Kai d76d3deb29 Add CTFontManagerCreateFontDescriptorFromData for avoid CGFont 2020-09-13 20:03:50 +08:00
Colin Rofls a7075f3b9d Use wrap_under_get_rule where expected
I had initially thought I could skip a retain in these cases since
we can trivially track the lifetime of the reference, but I ran into
a segfault in a test that used the empty string, which I tracked
down to here.

I'm not totally sure what's actually going on under the hood, but I
do know that this fixes my crash and also that I was being overly
clever anyway.
2020-06-29 15:06:27 -04:00
Colin Rofls 560b591ad5 Add CTFrame::get_line_origins and CTFrame::get_path 2020-05-11 14:40:31 -04:00
Colin Rofls bab39948b1 Add CTFrame::get_lines
This is a bit unsatisfactory; there doesn't seem to be a memory safe
way to get access to the lines without an intermediate allocation.
2020-05-11 14:31:01 -04:00
bors-servo d4f514d12b Auto merge of #381 - cmyr:typographic-bounds, r=jdm
Add CTLine::get_typographic_bounds

This also adds a type, TypographicBounds, for reporting the result
of this method.

Again I'm happy to do this with pointers if that is preferred. 🤷
2020-05-09 12:12:20 -04:00
bors-servo 515b4b1646 Auto merge of #380 - cmyr:framesetter-size-with-constraints, r=jdm
Add CTFramesetter::suggest_frame_size_with_constraints

I'm not sure if there's a policy of trying to match the documented API exactly? It feels nice to not take pointers for return values, but I'm happy to do it either way.
2020-05-09 12:06:45 -04:00
Colin Rofls 9d56623167 Add CTFramesetter::suggest_frame_size_with_constraints 2020-05-09 11:45:08 -04:00
Colin Rofls 17801cceb3 Add CTLine::get_string_range 2020-05-09 11:43:36 -04:00
Colin Rofls b205c0fe7e Add CTLine::get_typographic_bounds
This also adds a type, TypographicBounds, for reporting the result
of this method.
2020-05-09 11:42:27 -04:00
Kornel acf2c86930 Fix style warnings 2020-05-08 11:42:06 +01:00
brunohgouveia b68e9c782a Change CFMutableAttributedString::set_attribute argument type 2020-04-17 20:35:11 +01:00
brunohgouveia 1f4c983cee Add missing APIs to CTLine 2020-04-13 21:25:53 +01:00
Max Brunsfeld 8c932e649b Add binding for CTRunGetStringIndices (CTRun::string_indices) 2020-01-08 16:42:33 -08:00
Anthony Ramine 24d9ccc2c3 Properly make core_text::font::Font be Send and Sync
The Apple documentation says:

> All individual functions in Core Text are thread-safe. Font objects (CTFont,
> CTFontDescriptor, and associated objects) can be used simultaneously by
> multiple operations, work queues, or threads. However, the layout objects
> (CTTypesetter, CTFramesetter, CTRun, CTLine, CTFrame, and associated objects)
> should be used in a single operation, work queue, or thread.

https://developer.apple.com/documentation/coretext
2019-11-05 12:17:49 +01:00
Wesley Moore bc20614a3b Add get_available_font_tables to CTFont 2019-10-11 16:49:05 +11:00
Birunthan Mohanathas 28557ccc85 Implement CTFontDescriptor::font_format() 2019-07-14 12:07:35 +03:00
Bruce Mitchener 0fbabb35e9 Use assert_eq! when possible instead of assert! 2019-03-21 21:55:00 +07:00
Bruce Mitchener d0a08919f4 core-text: Remove use of mem::transmute. 2019-03-18 09:27:59 +07:00
Bruce Mitchener 3e8acddee2 clippy: Use is_null instead of != ptr::null(). 2019-03-14 21:12:12 +07:00
Sam Rijs 20348e0b8f implement CTFont::get_glyph_with_name 2019-02-09 12:30:48 +11:00
Jeff Muizelaar 42889636bf Add some minimal bindings for CTLine and CTRun 2018-11-08 16:03:21 -05:00
Ryan Leckey 7ec49da393 Add CTFrame and CTFramesetter 2018-08-20 16:29:13 -07:00
Jeff Muizelaar eb8c53f8cd Comment out unused function 2018-08-07 17:28:17 -04:00
Patrick Walton d7b3893a2b Add a binding to CTFontGetGlyphCount() 2018-08-02 14:36:53 -07:00
Patrick Walton f89d2345de Make CTFontCollection::get_descriptors() return an Option.
It returns null if there are no matching fonts.
2018-07-27 15:09:47 -07:00
Patrick Walton 46f432ef1b Make get_advances_for_glyphs and get_vertical_translations_for_glyphs unsafe.
Closes #238.
2018-07-25 14:10:03 -07:00
Patrick Walton 243472042a Add several new functions to Core Graphics and Core Text for font-kit's use.
This bumps the major version of `core-text` since the previous version of
`get_glyphs_for_characters` was unsoundly marked safe before and is now marked
unsafe.
2018-07-25 08:50:35 -07:00
Jeff Muizelaar 645779912b Consistently use std::os::raw::c_void instead of libc::c_void
The major versions of cocoa and core-graphics are bumped as I believe
they are the only crates that meaningfully expose c_void.

Fixes #212
2018-05-06 19:00:37 -04:00
Jeff Muizelaar 5e77c85500 Expose CTFontCopyVariationAxes.
WebRender uses this function so it's probably useful to expose.
2018-05-03 17:01:26 -04:00
Josh Matthews e614c2df26 Only allow CFNumber font variations. 2018-05-02 16:56:27 -04:00
bors-servo 022d74218c Auto merge of #196 - jrmuizel:text-stronger-types, r=jdm
Use stronger types in the core-text CFDictionaries

<!-- 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/196)
<!-- Reviewable:end -->
2018-02-07 14:19:17 -05:00
Jeff Muizelaar b7f60a3c9d Use stronger types in the CFDictionaries 2018-02-07 14:11:21 -05:00
Jeff Muizelaar 97ec75c14d Redo the interface of CFDictionary and CFMutableDictionary
This is a pretty big change to take advantge of the type parameters.
It simplifies things and makes them more safe.
2018-02-07 10:58:33 -05:00
Birunthan Mohanathas c4344498ae Allow creating font descriptor with PostScript name 2018-02-06 17:49:05 -08:00
Lee Salzman 25ce729f76 allow creating a CTFont from a CGFont with variations 2018-02-06 07:42:06 -08:00