[][src]Macro glyph_brush::delegate_glyph_brush_builder_fns

macro_rules! delegate_glyph_brush_builder_fns {
    ($inner:ident) => { ... };
}

Macro to delegate builder methods to an inner glyph_brush::GlyphBrushBuilder

Implements:

  • add_font_bytes
  • add_font
  • initial_cache_size
  • gpu_cache_scale_tolerance
  • gpu_cache_position_tolerance
  • cache_glyph_positioning
  • cache_glyph_drawing

Example

use glyph_brush::*;
use std::hash::BuildHasher;

pub struct DownstreamGlyphBrushBuilder<'a, H> {
    inner: glyph_brush::GlyphBrushBuilder<'a, H>,
    some_config: bool,
}

impl<'a, H: BuildHasher> DownstreamGlyphBrushBuilder<'a, H> {
    delegate_glyph_brush_builder_fns!(inner);

    /// Sets some downstream configuration
    pub fn some_config(mut self, some_config: bool) -> Self {
        self.some_config = some_config;
        self
    }

    // Must be manually delegated
    pub fn section_hasher<T: BuildHasher>(
        self,
        section_hasher: T,
    ) -> DownstreamGlyphBrushBuilder<'a, T> {
        DownstreamGlyphBrushBuilder {
            inner: self.inner.section_hasher(section_hasher),
            some_config: self.some_config,
        }
    }

    pub fn build(self) -> DownstreamGlyphBrush {
        // ...
    }
}