@@ -278,9 +278,38 @@ The following list is a complete list of features that can be opt in and out.
278
278
279
279
- Font manipulation features
280
280
281
- | Name | Description | Additional Dependency | Default?|
282
- | ---------| --------------| --------| ------------|
283
- | ttf | Allows TrueType font support | rusttype, font-kit | Yes |
281
+ | Name | Description | Additional Dependency | Default? |
282
+ | ----------| ------------------------------------------| -----------------------| ----------|
283
+ | ttf | Allows TrueType font support | font-kit | Yes |
284
+ | ab_glyph | Skips loading system fonts, unlike ` ttf ` | ab_glyph | No |
285
+
286
+ ` ab_glyph ` supports TrueType and OpenType fonts, but does not attempt to
287
+ load fonts provided by the system on which it is running.
288
+ It is pure Rust, and easier to cross compile.
289
+ To use this, you * must* call ` plotters::style::register_font ` before
290
+ using any ` plotters ` functions which require the ability to render text.
291
+ This function only exists when the ` ab_glyph ` feature is enabled.
292
+ ``` rust
293
+ /// Register a font in the fonts table.
294
+ ///
295
+ /// The `name` parameter gives the name this font shall be referred to
296
+ /// in the other APIs, like `"sans-serif"`.
297
+ ///
298
+ /// Unprovided font styles for a given name will fallback to `FontStyle::Normal`
299
+ /// if that is available for that name, when other functions lookup fonts which
300
+ /// are registered with this function.
301
+ ///
302
+ /// The `bytes` parameter should be the complete contents
303
+ /// of an OpenType font file, like:
304
+ /// ```ignore
305
+ /// include_bytes!("FiraGO-Regular.otf")
306
+ /// ```
307
+ pub fn register_font (
308
+ name : & str ,
309
+ style : FontStyle ,
310
+ bytes : & 'static [u8 ],
311
+ ) -> Result <(), InvalidFont >
312
+ ```
284
313
285
314
- Coordinate features
286
315
0 commit comments