public void CodePointIsWhiteSpaceAscii() { for (uint i = 0; i <= 0x7Fu; i++) { Assert.True(UnicodeUtility.IsAsciiCodePoint(i)); Assert.Equal(CodePoint.IsWhiteSpace(new CodePoint(i)), char.IsWhiteSpace((char)i)); } }
public void CodePointIsWhiteSpaceBmp() { for (uint i = 0x7Fu + 1u; i <= 0xFFFFu; i++) { Assert.True(UnicodeUtility.IsBmpCodePoint(i)); Assert.Equal(CodePoint.IsWhiteSpace(new CodePoint(i)), char.IsWhiteSpace((char)i)); } }
internal void ToString(StringBuilder sb) { int n = m_charGroups.Count; if (n == 0) { return; } sb.Append(m_charGroups[0].Value); if (m_charGroups[0].CanBeSuperscript) { throw new NotImplementedException(); } bool isInSuperscript = false; for (int i = 1; i < n; i++) { float widthOfSpacingBefore = m_charGroups[i].OriginX - m_charGroups[i - 1].OriginXPlusAdvancement; if (isInSuperscript && !m_charGroups[i].CanBeSuperscript) { sb.Append("</sup>"); isInSuperscript = false; } bool flag1 = m_charGroups[i - 1].SingleSpaceWidth <= widthOfSpacingBefore; bool flag2 = m_charGroups[i].SingleSpaceWidth <= widthOfSpacingBefore; if (flag1 != flag2) { throw new NotImplementedException(); } if ((flag1 || m_charGroups[i].AlwaysInsertSpaceBefore) && !CodePoint.IsWhiteSpace(sb.CodePointsReverse().FirstOrDefault())) { sb.Append(' '); } if (!isInSuperscript && m_charGroups[i].CanBeSuperscript) { sb.Append("<sup>"); isInSuperscript = true; } sb.Append(m_charGroups[i].Value); } if (isInSuperscript) { sb.Append("</sup>"); } }
/// <summary> /// Gets a value indicating whether the glyph represents a whitespace character. /// </summary> /// <returns>The <see cref="bool"/>.</returns> public bool IsWhiteSpace() => CodePoint.IsWhiteSpace(this.Glyph.GlyphMetrics.CodePoint);