Skip to content

Commit c668e11

Browse files
committed
Render README from template
Signed-off-by: Aaron Erhardt <aaron.erhardt@t-online.de>
1 parent 7056fcc commit c668e11

File tree

2 files changed

+64
-6
lines changed

2 files changed

+64
-6
lines changed

README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,38 @@ The following list is a complete list of features that can be opt in and out.
535535

536536
- Font manipulation features
537537

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+
```
541570

542571
- Coordinate features
543572

plotters/src/lib.rs

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,9 +675,38 @@ The following list is a complete list of features that can be opt in and out.
675675
676676
- Font manipulation features
677677
678-
| Name | Description | Additional Dependency |Default?|
679-
|---------|--------------|--------|------------|
680-
| ttf | Allows TrueType font support | rusttype, font-kit | Yes |
678+
| Name | Description | Additional Dependency | Default? |
679+
|----------|------------------------------------------|-----------------------|----------|
680+
| ttf | Allows TrueType font support | font-kit | Yes |
681+
| ab_glyph | Skips loading system fonts, unlike `ttf` | ab_glyph | No |
682+
683+
`ab_glyph` supports TrueType and OpenType fonts, but does not attempt to
684+
load fonts provided by the system on which it is running.
685+
It is pure Rust, and easier to cross compile.
686+
To use this, you *must* call `plotters::style::register_font` before
687+
using any `plotters` functions which require the ability to render text.
688+
This function only exists when the `ab_glyph` feature is enabled.
689+
```rust
690+
/// Register a font in the fonts table.
691+
///
692+
/// The `name` parameter gives the name this font shall be referred to
693+
/// in the other APIs, like `"sans-serif"`.
694+
///
695+
/// Unprovided font styles for a given name will fallback to `FontStyle::Normal`
696+
/// if that is available for that name, when other functions lookup fonts which
697+
/// are registered with this function.
698+
///
699+
/// The `bytes` parameter should be the complete contents
700+
/// of an OpenType font file, like:
701+
/// ```ignore
702+
/// include_bytes!("FiraGO-Regular.otf")
703+
/// ```
704+
pub fn register_font(
705+
name: &str,
706+
style: FontStyle,
707+
bytes: &'static [u8],
708+
) -> Result<(), InvalidFont>
709+
```
681710
682711
- Coordinate features
683712

0 commit comments

Comments
 (0)