public FontTextureDataAtlas( FontTextureAtlasKind kind, float distanceRange, float size, float width, float height, FontTextureYOriginKind yOrigin ) { Kind = kind; DistanceRange = distanceRange; Size = size; Width = width; Height = height; YOrigin = yOrigin; }
private void DeserializeSignedDistanceField(FontTextureAtlasKind kind, JObject json) { JToken token = json["atlas"]; if (!System.Enum.TryParse <FontTextureYOriginKind>( token["yOrigin"].Value <string>(), true, out FontTextureYOriginKind yOriginKind )) { throw new System.NotImplementedException( $"atlas.yOrigin value '{token["yOrigin"].Value<string>()}' isn't implemented." ); } Atlas = new FontTextureDataAtlas( kind, token["distanceRange"].Value <float>(), token["size"].Value <float>(), token["width"].Value <float>(), token["height"].Value <float>(), yOriginKind ); token = json["metrics"]; Metrics = new FontTextureDataMetrics( token["emSize"].Value <float>(), token["lineHeight"].Value <float>(), token["ascender"].Value <float>(), token["descender"].Value <float>(), token["underlineY"].Value <float>(), token["underlineThickness"].Value <float>() ); foreach (JToken glyphToken in json["glyphs"].Children()) { FontTextureDataGlyph glyph; JToken planeBounds = glyphToken["planeBounds"], atlasBounds = glyphToken["atlasBounds"]; uint unicode = glyphToken["unicode"].Value <uint>(); if (planeBounds == null || atlasBounds == null) { glyph = new FontTextureDataGlyph( unicode, glyphToken["advance"].Value <double>() ); } else { glyph = new FontTextureDataGlyph( unicode, glyphToken["advance"].Value <double>(), DeserializeBounds(planeBounds), DeserializeBounds(atlasBounds) ); } Glyphs.Add(unicode, glyph); } }