Line data Source code
1 : // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 2 : // for details. All rights reserved. Use of this source code is governed by a 3 : // BSD-style license that can be found in the LICENSE file. 4 : 5 : export 'src/generated/glyph_set.dart'; 6 : export 'src/generated/top_level.dart'; 7 : 8 : import 'src/generated/ascii_glyph_set.dart'; 9 : import 'src/generated/glyph_set.dart'; 10 : import 'src/generated/unicode_glyph_set.dart'; 11 : 12 : /// A [GlyphSet] that always returns ASCII glyphs. 13 : const GlyphSet asciiGlyphs = AsciiGlyphSet(); 14 : 15 : /// A [GlyphSet] that always returns Unicode glyphs. 16 : const GlyphSet unicodeGlyphs = UnicodeGlyphSet(); 17 : 18 : /// Returns [asciiGlyphs] if [ascii] is `true` or [unicodeGlyphs] otherwise. 19 : /// 20 : /// Returns [unicodeGlyphs] by default. 21 0 : GlyphSet get glyphs => _glyphs; 22 0 : GlyphSet _glyphs = unicodeGlyphs; 23 : 24 : /// Whether the glyph getters return plain ASCII, as opposed to Unicode 25 : /// characters or sequences. 26 : /// 27 : /// Defaults to `false`. 28 0 : bool get ascii => glyphs == asciiGlyphs; 29 : 30 0 : set ascii(bool value) { 31 : _glyphs = value ? asciiGlyphs : unicodeGlyphs; 32 : } 33 : 34 : /// Returns [glyph] if Unicode glyph are allowed, and [alternative] if they 35 : /// aren't. 36 0 : String glyphOrAscii(String glyph, String alternative) => 37 0 : glyphs.glyphOrAscii(glyph, alternative);