private CharInfo GetCharInfo(ITeXFont texFont, TexStyle style) { if (this.TextStyle == null) return texFont.GetDefaultCharInfo(this.Character, style); else return texFont.GetCharInfo(this.Character, this.TextStyle, style); }
private TexEnvironment(TexStyle style, ITeXFont texFont, Brush background, Brush foreground) { if (style == TexStyle.Display || style == TexStyle.Text || style == TexStyle.Script || style == TexStyle.ScriptScript) this.Style = style; else this.Style = TexStyle.Display; this.TexFont = texFont; this.Background = background; this.Foreground = foreground; }
public TexCharMetric GetCharMetric(int font, char ch, TexStyle style) { return(fontData[font].GetCharacterData(ch).GetMetric(TexUtility.SizeFactor(style))); }
public TexRenderer GetRenderer(TexStyle style, double scale) { var environment = new TexEnvironment(style, new DefaultTexFont(scale)); return(new TexRenderer(CreateBox(environment), scale)); }
public double GetSupDrop(TexStyle style) => throw MethodNotSupported(nameof(GetSupDrop));
public double GetXHeight(TexStyle style, int fontId) => throw MethodNotSupported(nameof(GetXHeight));
public Result <CharInfo> GetCharInfo(string name, TexStyle style) => Result.Error <CharInfo>(MethodNotSupported(nameof(GetCharInfo)));
public ExtensionChar GetExtension(CharInfo charInfo, TexStyle style) => throw MethodNotSupported(nameof(GetExtension));
public double GetKern(CharFont leftCharFont, CharFont rightCharFont, TexStyle style) { if (leftCharFont.FontId != rightCharFont.FontId) return 0; var fontInfo = fontInfoList[leftCharFont.FontId]; return fontInfo.GetKern(leftCharFont.Character, rightCharFont.Character, GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint); }
public ExtensionChar GetExtension(CharInfo charInfo, TexStyle style) { var sizeFactor = GetSizeFactor(style); // Create character for each part of extension. var fontInfo = fontInfoList[charInfo.FontId]; var extension = fontInfo.GetExtension(charInfo.Character); var parts = new CharInfo[extension.Length]; for (int i = 0; i < extension.Length; i++) { if (extension[i] == (int)TexCharKind.None) parts[i] = null; else parts[i] = new CharInfo((char)extension[i], charInfo.Font, sizeFactor, charInfo.FontId, GetMetrics(new CharFont((char)extension[i], charInfo.FontId), sizeFactor)); } return new ExtensionChar(parts[TexFontUtilities.ExtensionTop], parts[TexFontUtilities.ExtensionMiddle], parts[TexFontUtilities.ExtensionBottom], parts[TexFontUtilities.ExtensionRepeat]); }
public double GetDenom2(TexStyle style) { return GetParameter("denom2") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint; }
public double GetDefaultLineThickness(TexStyle style) { return GetParameter("defaultrulethickness") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint; }
public CharInfo GetDefaultCharInfo(char character, TexStyle style) { if (character >= '0' && character <= '9') return GetCharInfo(character, defaultTextStyleMappings[(int)TexCharKind.Numbers], style); else if (character >= 'a' && character <= 'z') return GetCharInfo(character, defaultTextStyleMappings[(int)TexCharKind.Small], style); else return GetCharInfo(character, defaultTextStyleMappings[(int)TexCharKind.Capitals], style); }
public CharInfo GetCharInfo(CharFont charFont, TexStyle style) { var size = GetSizeFactor(style); var fontInfo = fontInfoList[charFont.FontId]; return new CharInfo(charFont.Character, fontInfo.Font, size, charFont.FontId, GetMetrics(charFont, size)); }
public CharInfo GetNextLargerCharInfo(CharInfo charInfo, TexStyle style) { var fontInfo = fontInfoList[charInfo.FontId]; var charFont = fontInfo.GetNextLarger(charInfo.Character); var newFontInfo = fontInfoList[charFont.FontId]; return new CharInfo(charFont.Character, newFontInfo.Font, GetSizeFactor(style), charFont.FontId, GetMetrics(charFont, GetSizeFactor(style))); }
private CharInfo GetCharInfo(ITeXFont texFont, TexStyle style) => TextStyle is null ? texFont.GetDefaultCharInfo(Character, style) : texFont.GetCharInfo(Character, TextStyle, style);
public double GetNum3(TexStyle style) { return GetParameter("num3") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint; }
public Result <CharInfo> GetDefaultCharInfo(char character, TexStyle style) => Result.Error <CharInfo>(MethodNotSupported(nameof(this.GetDefaultCharInfo)));
public double GetQuad(int fontId, TexStyle style) { var fontInfo = fontInfoList[fontId]; return fontInfo.GetQuad(GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint); }
public double GetQuad(int fontId, TexStyle style) => throw MethodNotSupported(nameof(GetQuad));
public double GetSkew(CharFont charFont, TexStyle style) { var fontInfo = fontInfoList[charFont.FontId]; char skewChar = fontInfo.SkewCharacter; if (skewChar == 1) return 0; return GetKern(charFont, new CharFont(skewChar, charFont.FontId), style); }
public double GetAxisHeight(TexStyle style) => throw MethodNotSupported(nameof(GetAxisHeight));
public double GetSpace(TexStyle style) { var spaceFontId = (int)generalSettings["spacefontid"]; var fontInfo = fontInfoList[spaceFontId]; return fontInfo.GetSpace(GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint); }
public double GetNum3(TexStyle style) => throw MethodNotSupported(nameof(GetNum3));
public double GetSupDrop(TexStyle style) { return GetParameter("supdrop") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint; }
public CharInfo GetCharInfo(string symbolName, TexStyle style) { var mapping = symbolMappings[symbolName]; if (mapping == null) throw new SymbolMappingNotFoundException(symbolName); return GetCharInfo((CharFont)mapping, style); }
public double GetXHeight(TexStyle style, int fontCode) { var fontInfo = fontInfoList[fontCode]; return fontInfo.GetXHeight(GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint); }
public TexCharMetric GetCharMetric(string symbol, TexStyle style) { return(GetChar(symbol).GetMetric(TexUtility.SizeFactor(style))); }
private static double GetSizeFactor(TexStyle style) { if (style < TexStyle.Script) return 1d; else if (style < TexStyle.ScriptScript) return (double)generalSettings["scriptfactor"]; else return (double)generalSettings["scriptscriptfactor"]; }
public TexEnvironment(TexStyle style, ITeXFont texFont) : this(style, texFont, null, null) { }
private CharInfo GetCharInfo(char character, CharFont[] charFont, TexStyle style) { TexCharKind charKind; int charIndexOffset; if (character >= '0' && character <= '9') { charKind = TexCharKind.Numbers; charIndexOffset = character - '0'; } else if (character >= 'a' && character <= 'z') { charKind = TexCharKind.Small; charIndexOffset = character - 'a'; } else { charKind = TexCharKind.Capitals; charIndexOffset = character - 'A'; } if (charFont[(int)charKind] == null) return GetDefaultCharInfo(character, style); else return GetCharInfo(new CharFont((char)(charFont[(int)charKind].Character + charIndexOffset), charFont[(int)charKind].FontId), style); }
public TexEnvironment(TexStyle style, ITeXFont mathFont, ITeXFont textFont) : this(style, mathFont, textFont, null, null) { }
public double GetAxisHeight(TexStyle style) { return GetParameter("axisheight") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint; }
public double GetDefaultLineThickness(TexStyle style) => throw MethodNotSupported(nameof(GetDefaultLineThickness));
public double GetBigOpSpacing4(TexStyle style) { return GetParameter("bigopspacing4") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint; }
public CharInfo GetNextLargerCharInfo(CharInfo charInfo, TexStyle style) => throw MethodNotSupported(nameof(GetNextLargerCharInfo));
public double GetXHeight(TexStyle style, int fontCode) { var fontInfo = fontInfoList[fontCode]; return(fontInfo.GetXHeight(GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint)); }
public Result <CharInfo> GetCharInfo(CharFont charFont, TexStyle style) => Result.Error <CharInfo>(MethodNotSupported(nameof(this.GetCharInfo)));
public double GetAxisHeight(TexStyle style) { return(GetParameter("axisheight") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint); }
public double GetKern(CharFont leftChar, CharFont rightChar, TexStyle style) => 0.0;
public double GetBigOpSpacing5(TexStyle style) { return(GetParameter("bigopspacing5") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint); }
public double GetSkew(CharFont charFont, TexStyle style) => throw MethodNotSupported(nameof(GetSkew));
public double GetSupDrop(TexStyle style) { return(GetParameter("supdrop") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint); }
public double GetSpace(TexStyle style) => throw MethodNotSupported(nameof(GetSpace));
public double GetNum3(TexStyle style) { return(GetParameter("num3") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint); }
public double GetBigOpSpacing5(TexStyle style) => throw MethodNotSupported(nameof(GetBigOpSpacing5));
public double GetDenom2(TexStyle style) { return(GetParameter("denom2") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint); }
protected override Result <CharInfo> GetCharInfo(ITeXFont font, TexStyle style) => font.GetCharInfo(this.Name, style);
public double GetDefaultLineThickness(TexStyle style) { return(GetParameter("defaultrulethickness") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint); }
public double GetDenom2(TexStyle style) => throw MethodNotSupported(nameof(GetDenom2));
protected override Result <CharInfo> GetCharInfo(ITeXFont texFont, TexStyle style) => this.IsDefaultTextStyle ? texFont.GetDefaultCharInfo(this.Character, style) : texFont.GetCharInfo(this.Character, this.TextStyle, style);
public TexRenderer GetRenderer(TexStyle style, double scale) { var environment = new TexEnvironment(style, new DefaultTexFont(scale)); return new TexRenderer(CreateBox(environment), scale); }
public CharInfo GetCharInfo(char character, string textStyle, TexStyle style) { var mapping = textStyleMappings[textStyle]; if (mapping == null) throw new TextStyleMappingNotFoundException(textStyle); return GetCharInfo(character, (CharFont[])mapping, style); }