/// <summary> /// get existing or create new one from current font setting /// </summary> /// <param name="glyphIndex"></param> /// <returns></returns> GlyphMeshData InternalGetGlyphMesh(ushort glyphIndex) { GlyphMeshData glyphMeshData; if (!_hintGlyphCollection.TryGetCacheGlyph(glyphIndex, out glyphMeshData)) { //if not found then create new glyph vxs and cache it _currentGlyphBuilder.SetHintTechnique(_currentHintTech); _currentGlyphBuilder.BuildFromGlyphIndex(glyphIndex, _currentFontSizeInPoints); GlyphDynamicOutline dynamicOutline = _currentGlyphBuilder.LatestGlyphFitOutline; //----------------------------------- glyphMeshData = new GlyphMeshData(); if (dynamicOutline != null) { //has dynamic outline data glyphMeshData.avgXOffsetToFit = dynamicOutline.AvgXFitOffset; glyphMeshData.orgBounds = dynamicOutline.OriginalGlyphControlBounds; glyphMeshData.dynamicOutline = dynamicOutline; } _hintGlyphCollection.RegisterCachedGlyph(glyphIndex, glyphMeshData); //----------------------------------- } return(glyphMeshData); }
public static void Build(this GlyphPathBuilder builder, char c, float sizeInPoints) { builder.BuildFromGlyphIndex((ushort)builder.Typeface.LookupIndex(c), sizeInPoints); }