Skip to content

Commit 31d9639

Browse files
committed
s/rustybuzz/harfruzz/g
1 parent 779ee85 commit 31d9639

File tree

4 files changed

+51
-51
lines changed

4 files changed

+51
-51
lines changed

examples/shape.rs

+26-26
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ struct Args {
4444
font_file: Option<PathBuf>,
4545
face_index: u32,
4646
font_ptem: Option<f32>,
47-
variations: Vec<rustybuzz::Variation>,
47+
variations: Vec<harfruzz::Variation>,
4848
text: Option<String>,
4949
text_file: Option<PathBuf>,
5050
unicodes: Option<String>,
51-
direction: Option<rustybuzz::Direction>,
52-
language: rustybuzz::Language,
53-
script: Option<rustybuzz::Script>,
51+
direction: Option<harfruzz::Direction>,
52+
language: harfruzz::Language,
53+
script: Option<harfruzz::Script>,
5454
utf8_clusters: bool,
55-
cluster_level: rustybuzz::BufferClusterLevel,
56-
features: Vec<rustybuzz::Feature>,
55+
cluster_level: harfruzz::BufferClusterLevel,
56+
features: Vec<harfruzz::Feature>,
5757
no_glyph_names: bool,
5858
no_positions: bool,
5959
no_advances: bool,
@@ -145,7 +145,7 @@ fn main() {
145145
}
146146

147147
let font_data = std::fs::read(font_path).unwrap();
148-
let mut face = rustybuzz::Face::from_slice(&font_data, args.face_index).unwrap();
148+
let mut face = harfruzz::Face::from_slice(&font_data, args.face_index).unwrap();
149149

150150
face.set_points_per_em(args.font_ptem);
151151

@@ -175,7 +175,7 @@ fn main() {
175175
};
176176

177177
for text in lines {
178-
let mut buffer = rustybuzz::UnicodeBuffer::new();
178+
let mut buffer = harfruzz::UnicodeBuffer::new();
179179
buffer.push_str(&text);
180180

181181
if let Some(d) = args.direction {
@@ -194,31 +194,31 @@ fn main() {
194194
buffer.reset_clusters();
195195
}
196196

197-
let glyph_buffer = rustybuzz::shape(&face, &args.features, buffer);
197+
let glyph_buffer = harfruzz::shape(&face, &args.features, buffer);
198198

199-
let mut format_flags = rustybuzz::SerializeFlags::default();
199+
let mut format_flags = harfruzz::SerializeFlags::default();
200200
if args.no_glyph_names {
201-
format_flags |= rustybuzz::SerializeFlags::NO_GLYPH_NAMES;
201+
format_flags |= harfruzz::SerializeFlags::NO_GLYPH_NAMES;
202202
}
203203

204204
if args.no_clusters || args.ned {
205-
format_flags |= rustybuzz::SerializeFlags::NO_CLUSTERS;
205+
format_flags |= harfruzz::SerializeFlags::NO_CLUSTERS;
206206
}
207207

208208
if args.no_positions {
209-
format_flags |= rustybuzz::SerializeFlags::NO_POSITIONS;
209+
format_flags |= harfruzz::SerializeFlags::NO_POSITIONS;
210210
}
211211

212212
if args.no_advances || args.ned {
213-
format_flags |= rustybuzz::SerializeFlags::NO_ADVANCES;
213+
format_flags |= harfruzz::SerializeFlags::NO_ADVANCES;
214214
}
215215

216216
if args.show_extents {
217-
format_flags |= rustybuzz::SerializeFlags::GLYPH_EXTENTS;
217+
format_flags |= harfruzz::SerializeFlags::GLYPH_EXTENTS;
218218
}
219219

220220
if args.show_flags {
221-
format_flags |= rustybuzz::SerializeFlags::GLYPH_FLAGS;
221+
format_flags |= harfruzz::SerializeFlags::GLYPH_FLAGS;
222222
}
223223

224224
println!("{}", glyph_buffer.serialize(&face, format_flags));
@@ -239,39 +239,39 @@ fn parse_unicodes(s: &str) -> Result<String, String> {
239239
Ok(text)
240240
}
241241

242-
fn parse_features(s: &str) -> Result<Vec<rustybuzz::Feature>, String> {
242+
fn parse_features(s: &str) -> Result<Vec<harfruzz::Feature>, String> {
243243
let mut features = Vec::new();
244244
for f in s.split(',') {
245-
features.push(rustybuzz::Feature::from_str(&f)?);
245+
features.push(harfruzz::Feature::from_str(&f)?);
246246
}
247247

248248
Ok(features)
249249
}
250250

251-
fn parse_variations(s: &str) -> Result<Vec<rustybuzz::Variation>, String> {
251+
fn parse_variations(s: &str) -> Result<Vec<harfruzz::Variation>, String> {
252252
let mut variations = Vec::new();
253253
for v in s.split(',') {
254-
variations.push(rustybuzz::Variation::from_str(&v)?);
254+
variations.push(harfruzz::Variation::from_str(&v)?);
255255
}
256256

257257
Ok(variations)
258258
}
259259

260-
fn parse_cluster(s: &str) -> Result<rustybuzz::BufferClusterLevel, String> {
260+
fn parse_cluster(s: &str) -> Result<harfruzz::BufferClusterLevel, String> {
261261
match s {
262-
"0" => Ok(rustybuzz::BufferClusterLevel::MonotoneGraphemes),
263-
"1" => Ok(rustybuzz::BufferClusterLevel::MonotoneCharacters),
264-
"2" => Ok(rustybuzz::BufferClusterLevel::Characters),
262+
"0" => Ok(harfruzz::BufferClusterLevel::MonotoneGraphemes),
263+
"1" => Ok(harfruzz::BufferClusterLevel::MonotoneCharacters),
264+
"2" => Ok(harfruzz::BufferClusterLevel::Characters),
265265
_ => Err(format!("invalid cluster level")),
266266
}
267267
}
268268

269-
fn system_language() -> rustybuzz::Language {
269+
fn system_language() -> harfruzz::Language {
270270
unsafe {
271271
libc::setlocale(libc::LC_ALL, b"\0" as *const _ as *const i8);
272272
let s = libc::setlocale(libc::LC_CTYPE, std::ptr::null());
273273
let s = std::ffi::CStr::from_ptr(s);
274274
let s = s.to_str().expect("locale must be ASCII");
275-
rustybuzz::Language::from_str(s).unwrap()
275+
harfruzz::Language::from_str(s).unwrap()
276276
}
277277
}

src/hb/face.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl<'a> hb_font_t<'a> {
296296
bbox = glyf.bbox(glyph);
297297
}
298298

299-
// See https://github.com/RazrFalcon/rustybuzz/pull/98#issuecomment-1948430785
299+
// See https://github.com/RazrFalcon/harfruzz/pull/98#issuecomment-1948430785
300300
if self.ttfp_face.tables().glyf.is_some() && bbox.is_none() {
301301
// Empty glyph; zero extents.
302302
return true;

src/hb/shape_wasm.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ fn font_get_glyph(caller: Caller<'_, ShapingData>, _font: u32, codepoint: u32, u
134134
// fn font_get_scale(font: u32, x_scale: *mut i32, y_scale: *mut i32);
135135
// Returns the scale of the current font.
136136
fn font_get_scale(mut caller: Caller<'_, ShapingData>, _font: u32, x_scale: u32, y_scale: u32) {
137-
// Return upem as rustybuzz has no scale.
137+
// Return upem as harfruzz has no scale.
138138
let memory = caller.get_export("memory").unwrap().into_memory().unwrap();
139139
let upem = caller.data().font.units_per_em();
140140

@@ -550,8 +550,8 @@ fn shape_with(
550550
.unwrap_or_default()
551551
.to_string_lossy();
552552

553-
if !(shaper.eq_ignore_ascii_case("ot") || shaper.eq_ignore_ascii_case("rustybuzz")) {
554-
log::warn!("Only ot shaper is available in rustybuzz.");
553+
if !(shaper.eq_ignore_ascii_case("ot") || shaper.eq_ignore_ascii_case("harfruzz")) {
554+
log::warn!("Only ot shaper is available in harfruzz.");
555555
return 0;
556556
}
557557

tests/shaping/main.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ mod wasm;
88

99
use std::str::FromStr;
1010

11-
use rustybuzz::BufferFlags;
11+
use harfruzz::BufferFlags;
1212

1313
struct Args {
1414
face_index: u32,
1515
font_ptem: Option<f32>,
1616
variations: Vec<String>,
17-
direction: Option<rustybuzz::Direction>,
18-
language: Option<rustybuzz::Language>,
19-
script: Option<rustybuzz::Script>,
17+
direction: Option<harfruzz::Direction>,
18+
language: Option<harfruzz::Language>,
19+
script: Option<harfruzz::Script>,
2020
#[allow(dead_code)]
2121
remove_default_ignorables: bool,
2222
unsafe_to_concat: bool,
23-
cluster_level: rustybuzz::BufferClusterLevel,
23+
cluster_level: harfruzz::BufferClusterLevel,
2424
features: Vec<String>,
2525
pre_context: Option<String>,
2626
post_context: Option<String>,
@@ -78,11 +78,11 @@ fn parse_string_list(s: &str) -> Result<Vec<String>, String> {
7878
Ok(s.split(',').map(|s| s.to_string()).collect())
7979
}
8080

81-
fn parse_cluster(s: &str) -> Result<rustybuzz::BufferClusterLevel, String> {
81+
fn parse_cluster(s: &str) -> Result<harfruzz::BufferClusterLevel, String> {
8282
match s {
83-
"0" => Ok(rustybuzz::BufferClusterLevel::MonotoneGraphemes),
84-
"1" => Ok(rustybuzz::BufferClusterLevel::MonotoneCharacters),
85-
"2" => Ok(rustybuzz::BufferClusterLevel::Characters),
83+
"0" => Ok(harfruzz::BufferClusterLevel::MonotoneGraphemes),
84+
"1" => Ok(harfruzz::BufferClusterLevel::MonotoneCharacters),
85+
"2" => Ok(harfruzz::BufferClusterLevel::Characters),
8686
_ => Err(format!("invalid cluster level")),
8787
}
8888
}
@@ -107,20 +107,20 @@ pub fn shape(font_path: &str, text: &str, options: &str) -> String {
107107

108108
let font_data =
109109
std::fs::read(font_path).unwrap_or_else(|e| panic!("Could not read {}: {}", font_path, e));
110-
let mut face = rustybuzz::Face::from_slice(&font_data, args.face_index).unwrap();
110+
let mut face = harfruzz::Face::from_slice(&font_data, args.face_index).unwrap();
111111

112112
face.set_points_per_em(args.font_ptem);
113113

114114
if !args.variations.is_empty() {
115115
let variations: Vec<_> = args
116116
.variations
117117
.iter()
118-
.map(|s| rustybuzz::Variation::from_str(s).unwrap())
118+
.map(|s| harfruzz::Variation::from_str(s).unwrap())
119119
.collect();
120120
face.set_variations(&variations);
121121
}
122122

123-
let mut buffer = rustybuzz::UnicodeBuffer::new();
123+
let mut buffer = harfruzz::UnicodeBuffer::new();
124124
if let Some(pre_context) = args.pre_context {
125125
buffer.set_pre_context(&pre_context);
126126
}
@@ -156,35 +156,35 @@ pub fn shape(font_path: &str, text: &str, options: &str) -> String {
156156

157157
let mut features = Vec::new();
158158
for feature_str in args.features {
159-
let feature = rustybuzz::Feature::from_str(&feature_str).unwrap();
159+
let feature = harfruzz::Feature::from_str(&feature_str).unwrap();
160160
features.push(feature);
161161
}
162162

163-
let glyph_buffer = rustybuzz::shape(&face, &features, buffer);
163+
let glyph_buffer = harfruzz::shape(&face, &features, buffer);
164164

165-
let mut format_flags = rustybuzz::SerializeFlags::default();
165+
let mut format_flags = harfruzz::SerializeFlags::default();
166166
if args.no_glyph_names {
167-
format_flags |= rustybuzz::SerializeFlags::NO_GLYPH_NAMES;
167+
format_flags |= harfruzz::SerializeFlags::NO_GLYPH_NAMES;
168168
}
169169

170170
if args.no_clusters || args.ned {
171-
format_flags |= rustybuzz::SerializeFlags::NO_CLUSTERS;
171+
format_flags |= harfruzz::SerializeFlags::NO_CLUSTERS;
172172
}
173173

174174
if args.no_positions {
175-
format_flags |= rustybuzz::SerializeFlags::NO_POSITIONS;
175+
format_flags |= harfruzz::SerializeFlags::NO_POSITIONS;
176176
}
177177

178178
if args.no_advances || args.ned {
179-
format_flags |= rustybuzz::SerializeFlags::NO_ADVANCES;
179+
format_flags |= harfruzz::SerializeFlags::NO_ADVANCES;
180180
}
181181

182182
if args.show_extents {
183-
format_flags |= rustybuzz::SerializeFlags::GLYPH_EXTENTS;
183+
format_flags |= harfruzz::SerializeFlags::GLYPH_EXTENTS;
184184
}
185185

186186
if args.show_flags {
187-
format_flags |= rustybuzz::SerializeFlags::GLYPH_FLAGS;
187+
format_flags |= harfruzz::SerializeFlags::GLYPH_FLAGS;
188188
}
189189

190190
glyph_buffer.serialize(&face, format_flags)

0 commit comments

Comments
 (0)