text/glyph_type.go

Functions

Functions

func Has

Has returns true if the flags contain the specified flag.

func (f GlyphFlags) Has(flag GlyphFlags) bool {
	return f&flag != 0
}

func String

String returns the string representation of the glyph type.

func (t GlyphType) String() string {
	switch t {
	case GlyphTypeOutline:
		return "Outline"
	case GlyphTypeBitmap:
		return "Bitmap"
	case GlyphTypeCOLR:
		return "COLR"
	case GlyphTypeSVG:
		return "SVG"
	default:
		return unknownStr
	}
}

func String

String returns a human-readable representation of the flags.

func (f GlyphFlags) String() string {
	if f == 0 {
		return noneStr
	}

	var result string
	if f.Has(GlyphFlagLigature) {
		result += "Ligature|"
	}
	if f.Has(GlyphFlagMark) {
		result += "Mark|"
	}
	if f.Has(GlyphFlagSafeToBreak) {
		result += "SafeToBreak|"
	}
	if f.Has(GlyphFlagClusterStart) {
		result += "ClusterStart|"
	}

	// Remove trailing pipe
	if result != "" {
		result = result[:len(result)-1]
	}
	return result
}