Crates.io | ar-reshaper |
lib.rs | ar-reshaper |
version | 1.5.0 |
source | src |
created_at | 2023-06-14 13:29:25.580322 |
updated_at | 2024-01-20 15:08:33.684689 |
description | A no-std crate to reconstruct Arabic, turkish and persian sentences to be used in applications that don't support Arabic script. |
homepage | |
repository | https://github.com/YouKnow-sys/ar-reshaper |
max_upload_size | |
id | 890118 |
size | 120,097 |
A no-std crate to reconstruct Arabic, Turkish and Persian sentences to be used in applications that don't support Arabic script.
resahpe a single line of string
use ar_reshaper::{ArabicReshaper, reshape_line};
let reshaper = ArabicReshaper::default();
// You can reshape just a single string using
println!("{}", reshaper.reshape("سلام دنیا"));
// or using `reshape_line` method if you dont want to construct the [ArabicReshaper]
// and you just want to reshape a few strings with default config
println!("{}", reshape_line("سلام دنیا"));
// Both will reconstruct the string and print `ﺳﻼﻡ ﺩﻧﯿﺎ`
reshape a slice of strings
use ar_reshaper::ArabicReshaper;
let reshaper = ArabicReshaper::default();
let lines = [
"سلام",
"سلام، خوبی؟",
];
println!("{:#?}", reshaper.reshape_lines(lines));
// or you can just use reshape method in a loop... the choice is yours.
reshape strings on a iterator
use ar_reshaper::prelude::*;
for line in ["یک", "دو"].iter().reshape_default() {
println!("{line}");
}
You can check examples or tests directory for more examples.
ReshaperConfig
can be serialized and de-serialized using serde.ReshaperConfig
method will have another extra
method named from_font
that can be used to enable ligatures only if they exist in the input font.alloc
internally.this project is based on the awesome python-arabic-reshaper
.