Skip to content

Commit 0bb6661

Browse files
committed
Port print_size
1 parent b502e0a commit 0bb6661

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

crates/engine_xetex/src/c_api/engine.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ pub const PRIM_SIZE: usize = 2100;
1212
pub const UNDEFINED_CONTROL_SEQUENCE: usize = 0x226603;
1313
pub const FROZEN_NULL_FONT: usize = 0x2242da;
1414

15+
pub const TEXT_SIZE: usize = 0;
16+
pub const SCRIPT_SIZE: usize = 256;
17+
pub const SCRIPT_SCRIPT_SIZE: usize = 512;
18+
1519
thread_local! {
1620
pub static ENGINE_CTX: RefCell<EngineCtx> = RefCell::new(EngineCtx::new())
1721
}

crates/engine_xetex/src/c_api/output.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::c_api::engine::{
22
rs_gettexstring, CatCode, IntPar, Selector, ACTIVE_BASE, EQTB_SIZE, FROZEN_NULL_FONT, NULL_CS,
3-
PRIM_EQTB_BASE, SINGLE_BASE, UNDEFINED_CONTROL_SEQUENCE,
3+
PRIM_EQTB_BASE, SCRIPT_SIZE, SINGLE_BASE, TEXT_SIZE, UNDEFINED_CONTROL_SEQUENCE,
44
};
55
use crate::c_api::globals::Globals;
66
use crate::c_api::hash::HASH_BASE;
@@ -786,3 +786,19 @@ pub fn rs_print_file_name(globals: &mut Globals<'_, '_>, n: i32, a: i32, e: i32)
786786
pub extern "C" fn print_file_name(n: i32, a: i32, e: i32) {
787787
Globals::with(|globals| rs_print_file_name(globals, n, a, e))
788788
}
789+
790+
pub fn rs_print_size(globals: &mut Globals<'_, '_>, s: i32) {
791+
let s = s as usize;
792+
if s == TEXT_SIZE {
793+
rs_print_esc_bytes(globals, b"textfont");
794+
} else if s == SCRIPT_SIZE {
795+
rs_print_esc_bytes(globals, b"scriptfont");
796+
} else {
797+
rs_print_esc_bytes(globals, b"scriptscriptfont");
798+
}
799+
}
800+
801+
#[no_mangle]
802+
pub extern "C" fn print_size(s: i32) {
803+
Globals::with(|globals| rs_print_size(globals, s))
804+
}

crates/engine_xetex/xetex/xetex-output.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,6 @@
99
#include "tectonic_bridge_core.h"
1010
#include "xetex_bindings.h"
1111

12-
void
13-
print_size(int32_t s)
14-
{
15-
if (s == TEXT_SIZE)
16-
print_esc_cstr("textfont");
17-
else if (s == SCRIPT_SIZE)
18-
print_esc_cstr("scriptfont");
19-
else
20-
print_esc_cstr("scriptscriptfont");
21-
}
22-
23-
2412
void
2513
print_write_whatsit(const char* s, int32_t p)
2614
{

0 commit comments

Comments
 (0)