forked from emacs-ng/emacs-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move funcs in wrfont.c to Rust crate font and turn them to lisp
- Loading branch information
1 parent
3da968b
commit eeca50b
Showing
7 changed files
with
70 additions
and
62 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use emacs_sys::bindings::globals; | ||
use emacs_sys::bindings::CHECK_SYMBOL; | ||
use emacs_sys::bindings::CONSP; | ||
use emacs_sys::bindings::XCAR; | ||
use emacs_sys::bindings::XCDR; | ||
use emacs_sys::globals::Qnil; | ||
use emacs_sys::lisp::LispObject; | ||
use lisp_macros::lisp_fn; | ||
|
||
/// Convert emacs script name to OTF 4-letter script code. | ||
/// See `otf-script-alist'. | ||
#[lisp_fn(min = "1")] | ||
pub fn script_to_otf(script: LispObject) -> LispObject { | ||
use emacs_sys::bindings::Frassq; | ||
unsafe { CHECK_SYMBOL(script) }; | ||
let otf = unsafe { Frassq(script, globals.Votf_script_alist) }; | ||
if otf.is_cons() { | ||
let otf = otf.force_cons(); | ||
return otf.car(); | ||
} | ||
Qnil | ||
} | ||
|
||
/// Convert a font registry. | ||
/// See `registry-script-alist'. | ||
#[lisp_fn(min = "1")] | ||
pub fn registry_to_script(reg: LispObject) -> LispObject { | ||
unsafe { CHECK_SYMBOL(reg) }; | ||
|
||
use emacs_sys::bindings::strncmp; | ||
use emacs_sys::bindings::SBYTES; | ||
use emacs_sys::bindings::SSDATA; | ||
use emacs_sys::bindings::SYMBOL_NAME; | ||
|
||
let mut rsa = unsafe { globals.Vregistry_script_alist }; | ||
let mut r; | ||
while unsafe { CONSP(rsa) } { | ||
r = unsafe { XCAR(XCAR(rsa)) }; | ||
if !unsafe { | ||
strncmp( | ||
SSDATA(r), | ||
SSDATA(SYMBOL_NAME(reg)), | ||
SBYTES(r).try_into().unwrap(), | ||
) != 0 | ||
} { | ||
return unsafe { XCDR(XCAR(rsa)) }; | ||
} | ||
rsa = unsafe { XCDR(rsa) }; | ||
} | ||
return Qnil; | ||
} | ||
|
||
include!(concat!(env!("OUT_DIR"), "/fns_exports.rs")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters