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

Port xetex_layout to Rust #1138

Draft
wants to merge 137 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
36882a2
Start porting xetex-layout
CraftSpider Oct 2, 2023
91fba0b
Fix build on linux
CraftSpider Oct 3, 2023
2567e4d
Port a lot to Rust
CraftSpider Oct 5, 2023
976d3c8
Port 99% of XeTeXFont and XeTeXLayoutEngine to Rust
CraftSpider Feb 5, 2024
0e20822
Start porting FontMgr - tex_outputs should pass!
CraftSpider Feb 5, 2024
9077a26
Impl {append,prepend}_to_list
CraftSpider Feb 5, 2024
3204452
Continue port. FontManagerBackend functionality mostly implemented fo…
CraftSpider Feb 7, 2024
64b65b2
Minor cleanup, work on type errors.
CraftSpider Feb 7, 2024
d9757c4
Encapsulate Fc unsafe a bit - use a `Pattern` type for most situations.
CraftSpider Feb 7, 2024
d44bf88
More cleanups, put unicode in the right place
CraftSpider Feb 7, 2024
8219745
Stop compiling the C++ code. Remove unnecessary functions.
CraftSpider Feb 7, 2024
bec3332
Remove unnecessary static link modifiers
CraftSpider Feb 8, 2024
de1a736
Set up symbol versioning
CraftSpider Feb 9, 2024
2f494d4
Try fixing symbol name setup
CraftSpider Feb 9, 2024
36f50a0
Start work on making mac run
CraftSpider Feb 10, 2024
a80c108
Fix minor errors
CraftSpider Feb 10, 2024
ce0a703
Fix pathname
CraftSpider Feb 10, 2024
eae2dff
Hopefully make new_path_index work on mac
CraftSpider Feb 10, 2024
554aa6f
Fix drop on mac
CraftSpider Feb 10, 2024
b3359f5
Continue work on porting Mac to CoreText.
CraftSpider Feb 20, 2024
0ab8a70
Mac stuff!
CraftSpider Mar 20, 2024
8a9808d
Fix type error
CraftSpider Mar 20, 2024
117ae98
Fix CString creation
CraftSpider Mar 20, 2024
29f171b
Add ref
CraftSpider Mar 20, 2024
1fbddd9
Fix deref
CraftSpider Mar 20, 2024
9943557
Make findFontByName work on Mac
CraftSpider Mar 21, 2024
efdbf47
Setup linkage for mac externs
CraftSpider Mar 21, 2024
d798381
Debugging prints
CraftSpider Mar 21, 2024
b98df0e
Nocapture for tests temporarily
CraftSpider Mar 21, 2024
3b14093
Remove probably bad CFRelease
CraftSpider Mar 21, 2024
b48721e
More debug prints
CraftSpider Mar 21, 2024
c8a573e
More debug prints
CraftSpider Mar 21, 2024
06b97e7
Clearer array pointer creation
CraftSpider Mar 21, 2024
29a5867
Fix build
CraftSpider Mar 21, 2024
2fc19bc
Fix another keys location
CraftSpider Mar 21, 2024
7e8a80b
More debugging
CraftSpider Mar 21, 2024
1800b58
Add null checks
CraftSpider Mar 21, 2024
d415054
Try fix for heap corruption
CraftSpider Mar 22, 2024
9eb4a0f
Fixup freetype - move unsafe into the freetype bindings, with safe in…
CraftSpider Mar 22, 2024
b25db17
Fix panic on bad engine creation
CraftSpider Mar 22, 2024
a6de6e0
Fix build
CraftSpider Mar 22, 2024
7d93e4e
Fix otf_basic and remove font_ref from engine
CraftSpider Mar 23, 2024
ef3eb5f
Fixup mac use of fc
CraftSpider Mar 23, 2024
a6dfd86
Remove unused import
CraftSpider Mar 23, 2024
97bc812
Revert build script changes
CraftSpider Mar 23, 2024
a3cb9f7
Fix clippy
CraftSpider Mar 23, 2024
77801b2
Hopefully fix mac
CraftSpider Mar 23, 2024
bf0dca5
Partway through changes
CraftSpider Mar 23, 2024
b5e46f0
Use less unsafe in string manip
CraftSpider Mar 24, 2024
a28db13
Start encapsulating harfbuzz
CraftSpider Mar 24, 2024
9c5fbd1
Port FontFuncs
CraftSpider Mar 24, 2024
9701dd3
HB builds on Windows - now just to fix the bugs
CraftSpider Mar 25, 2024
259caa5
Cleanup
CraftSpider Mar 25, 2024
b291cad
Add some asserts
CraftSpider Mar 25, 2024
07bc8f4
Fix assertion failure, add test for shaper code
CraftSpider Mar 26, 2024
3cf4bf6
Fix mac build errors
CraftSpider Mar 26, 2024
63e6810
Remove support for MACOS <= 10.6
CraftSpider Mar 26, 2024
f3673e9
Remove outdated comment
CraftSpider Mar 27, 2024
258a6af
Fix getIndFeature/countFeatures
CraftSpider Mar 27, 2024
9944d52
Remove outdated comment
CraftSpider Mar 27, 2024
67eb673
Fix AFM handling, a little more safety and debug asserts
CraftSpider Mar 28, 2024
569d916
Fix single-char bug that took 3 days to diagnose.
CraftSpider Mar 30, 2024
6d30d72
Minor cleanups
CraftSpider Mar 30, 2024
984126f
fix2d/d2fix cleanup
CraftSpider Mar 30, 2024
4f340dc
Change shaper in engine.rs to CString
CraftSpider Mar 31, 2024
0a49942
Step 1 of graphite2 API cleanup
CraftSpider Apr 1, 2024
bc88d14
Start on gr_seg
CraftSpider Apr 1, 2024
cc442a7
Finish porting graphite2 to safe interface
CraftSpider Apr 1, 2024
9381c88
Fix clippy
CraftSpider Apr 1, 2024
32ba5d5
Engine takes ownership, not reference
CraftSpider Apr 5, 2024
016f126
Start on graphite test
CraftSpider Apr 7, 2024
3eef6ab
Work on graphite engine
CraftSpider Apr 8, 2024
fca53fd
Graphite test working - still need to add feature enablement example
CraftSpider Apr 8, 2024
5b6c5ec
Add Graphite feature test and fix feature selection by 4-letter code.
CraftSpider Apr 9, 2024
ae30f76
Clippy cleanup
CraftSpider Apr 9, 2024
113ec60
Start work on making Mac safe also - basically copying Servo's way of…
CraftSpider Apr 11, 2024
3e70ac0
Move mac stuff to its own library
CraftSpider Apr 12, 2024
e8436ab
Add mac_core commit
CraftSpider Apr 12, 2024
1701466
Add PartialEq/Eq/Hash impls for mac_core types
CraftSpider Apr 12, 2024
c87a2fb
Fix raw->rs font ref handling
CraftSpider Apr 12, 2024
b7047ce
Fix CFArray handling
CraftSpider Apr 12, 2024
1b73e52
Fix mac build issues
CraftSpider Apr 12, 2024
78fedea
Fix clippy on non-mac
CraftSpider Apr 12, 2024
ac5b8d2
Fix matching_font_descriptors
CraftSpider Apr 12, 2024
63c2602
Graphite debug prints
CraftSpider Apr 13, 2024
eaf35b3
Nocapture
CraftSpider Apr 13, 2024
ff8e6a4
More debugging
CraftSpider Apr 13, 2024
d0b25ae
Label println
CraftSpider Apr 13, 2024
9554c42
More granular logs
CraftSpider Apr 13, 2024
f7e9c1b
Hope the failure is in Rust
CraftSpider Apr 14, 2024
1182eef
More println debugging
CraftSpider Apr 14, 2024
b29bb66
Remove an allocation - print some useful info on destroy
CraftSpider Apr 15, 2024
1404c21
Don't cross allocators/deallocators
CraftSpider Apr 16, 2024
47e7520
Remove println
CraftSpider Apr 17, 2024
42e3145
Update mac_core commit
CraftSpider Apr 17, 2024
3a82bca
Fix up font maps - even less unsafe
CraftSpider Apr 18, 2024
9eb6482
Encapsulate Fc API
CraftSpider Apr 18, 2024
c329232
Encapsulate ICU API
CraftSpider Apr 18, 2024
c07bf4b
Fix mac build
CraftSpider Apr 18, 2024
232a198
Fix clippy
CraftSpider Apr 18, 2024
8323720
Move more thread_local values into the font manager
CraftSpider Apr 18, 2024
e9e994f
Remove FcBackend thread locals
CraftSpider Apr 18, 2024
947b379
Move graphite breaking thread_locals into the engine
CraftSpider Apr 18, 2024
ff3e1be
Update tectonic_xetex_layout
CraftSpider Apr 18, 2024
8f9cec6
Add safety documentation to bridge_freetype2, and improve soundness w…
CraftSpider Apr 18, 2024
cce3f22
Fix mac build
CraftSpider Apr 18, 2024
df08e0a
Add safety documentation to bridge_graphite2, and improve soundness.
CraftSpider Apr 18, 2024
d4a008e
Add safety documentation to bridge_icu
CraftSpider Apr 18, 2024
596cd5f
Improve Harfbuzz soundness - start on safety documentation.
CraftSpider Apr 23, 2024
e45604e
Fix ShapePlanMut
CraftSpider Apr 23, 2024
4679393
Fix Harfbuzz, add safety documentation.
CraftSpider Apr 24, 2024
a43c533
Shorten some method names, make Harfbuzz OpenType API nicer, and avoi…
CraftSpider Apr 25, 2024
10dcca4
Clippy fixes. A little more usize.
CraftSpider Apr 25, 2024
dbb3d5f
Rename XeTeXFontBase/XeTeXLayoutEngineBase as they don't need to be t…
CraftSpider Apr 25, 2024
1128618
Move fontconfig to its own crate
CraftSpider Apr 27, 2024
bd333b0
Add FC commit hash
CraftSpider Apr 27, 2024
9d6190b
Separate out no_mangle functions, remove pure Rust stuff from c_api m…
CraftSpider Apr 27, 2024
dbd2d51
Minor cleanup
CraftSpider Apr 27, 2024
852e6ba
Fix mac build hopefully
CraftSpider Apr 27, 2024
e3e90cf
Fix fontconfig build script/dep handling
CraftSpider Apr 28, 2024
d881a49
Add cranko commit for bridge_fontconfig
CraftSpider Apr 28, 2024
719db18
Fixup build scripts
CraftSpider Apr 28, 2024
59cd924
Try to fix include paths
CraftSpider Apr 29, 2024
8c991d2
Fix harfbuzz build again
CraftSpider Apr 29, 2024
c5b9c7a
Add freetype2 to HB deps
CraftSpider Apr 29, 2024
e2f9d5e
Add ICU dep and export its headers in engine_xetex
CraftSpider Apr 29, 2024
ff4df63
Fix mac compile more, clippy
CraftSpider Apr 29, 2024
a7ac5f3
Fix mac build pt 2
CraftSpider Apr 29, 2024
bdad9d3
Fix fontconfig cranko
CraftSpider Aug 9, 2024
67c2e05
Fix mac_core cranko
CraftSpider Aug 9, 2024
7340cb9
Fix compile error hopefully, remove never-used debug code
CraftSpider Aug 10, 2024
8d815f9
Remove cstr. Update docs.
CraftSpider Feb 21, 2025
b5ea3ed
Allow using current bridge state from Rust, use Rust APIs for inputs
CraftSpider Feb 21, 2025
4e07174
Fix commit
CraftSpider Feb 22, 2025
b4f5ea6
Fix mac compile
CraftSpider Feb 22, 2025
9e9b9e0
Fix clippy
CraftSpider Feb 22, 2025
fc66480
Fix compile again
CraftSpider Feb 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix mac build hopefully
CraftSpider committed Feb 21, 2025
commit 852e6bae1af80f44fb4233dd30043dd3ea27c0ef
4 changes: 3 additions & 1 deletion crates/xetex_layout/src/c_api/font.rs
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@ use std::ffi::{CStr, CString};
use std::ptr;
use tectonic_bridge_freetype2 as ft;
use tectonic_bridge_harfbuzz as hb;
#[cfg(target_os = "macos")]
use tectonic_mac_core::{CTFont, CTFontRef};

#[no_mangle]
pub unsafe extern "C" fn hasFontTable(font: XeTeXFont, table_tag: OTTag) -> bool {
@@ -218,7 +220,7 @@ pub unsafe extern "C" fn getFileNameFromCTFont(
index: *mut u32,
) -> *const libc::c_char {
use std::ptr::NonNull;
crate::c_api::font::get_file_name_from_ct_font(
crate::font::get_file_name_from_ct_font(
&CTFont::new_borrowed(NonNull::new(ct_font.cast_mut()).unwrap()),
&mut *index,
)
5 changes: 1 addition & 4 deletions crates/xetex_layout/src/font.rs
Original file line number Diff line number Diff line change
@@ -13,11 +13,8 @@ use tectonic_bridge_fontconfig as fc;
use tectonic_bridge_freetype2 as ft;
use tectonic_bridge_harfbuzz as hb;
#[cfg(target_os = "macos")]
use tectonic_mac_core::sys::CTFontRef;
#[cfg(target_os = "macos")]
use tectonic_mac_core::{
CFArray, CFDictionary, CFString, CFType, CFUrl, CTFont, CTFontDescriptor, CoreType,
FontAttribute, FontNameKey,
CFArray, CFDictionary, CFType, CFUrl, CTFont, CTFontDescriptor, FontAttribute, FontNameKey,
};

fn get_glyph_advance(face: &ft::Face, gid: libc::c_uint, vertical: bool) -> ft::Fixed {