@@ -535,9 +535,38 @@ The following list is a complete list of features that can be opt in and out.
535
535
536
536
- Font manipulation features
537
537
538
- | Name | Description | Additional Dependency | Default?|
539
- | ---------| --------------| --------| ------------|
540
- | ttf | Allows TrueType font support | rusttype, font-kit | Yes |
538
+ | Name | Description | Additional Dependency | Default? |
539
+ | ----------| ------------------------------------------| -----------------------| ----------|
540
+ | ttf | Allows TrueType font support | font-kit | Yes |
541
+ | ab_glyph | Skips loading system fonts, unlike ` ttf ` | ab_glyph | No |
542
+
543
+ ` ab_glyph ` supports TrueType and OpenType fonts, but does not attempt to
544
+ load fonts provided by the system on which it is running.
545
+ It is pure Rust, and easier to cross compile.
546
+ To use this, you * must* call ` plotters::style::register_font ` before
547
+ using any ` plotters ` functions which require the ability to render text.
548
+ This function only exists when the ` ab_glyph ` feature is enabled.
549
+ ``` rust
550
+ /// Register a font in the fonts table.
551
+ ///
552
+ /// The `name` parameter gives the name this font shall be referred to
553
+ /// in the other APIs, like `"sans-serif"`.
554
+ ///
555
+ /// Unprovided font styles for a given name will fallback to `FontStyle::Normal`
556
+ /// if that is available for that name, when other functions lookup fonts which
557
+ /// are registered with this function.
558
+ ///
559
+ /// The `bytes` parameter should be the complete contents
560
+ /// of an OpenType font file, like:
561
+ /// ```ignore
562
+ /// include_bytes!("FiraGO-Regular.otf")
563
+ /// ```
564
+ pub fn register_font (
565
+ name : & str ,
566
+ style : FontStyle ,
567
+ bytes : & 'static [u8 ],
568
+ ) -> Result <(), InvalidFont >
569
+ ```
541
570
542
571
- Coordinate features
543
572
0 commit comments