Пример #1
0
 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);
 }
Пример #2
0
        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;
        }
Пример #3
0
 public TexCharMetric GetCharMetric(int font, char ch, TexStyle style)
 {
     return(fontData[font].GetCharacterData(ch).GetMetric(TexUtility.SizeFactor(style)));
 }
Пример #4
0
        public TexRenderer GetRenderer(TexStyle style, double scale)
        {
            var environment = new TexEnvironment(style, new DefaultTexFont(scale));

            return(new TexRenderer(CreateBox(environment), scale));
        }
Пример #5
0
 public double GetSupDrop(TexStyle style) => throw MethodNotSupported(nameof(GetSupDrop));
Пример #6
0
 public double GetXHeight(TexStyle style, int fontId) => throw MethodNotSupported(nameof(GetXHeight));
Пример #7
0
 public Result <CharInfo> GetCharInfo(string name, TexStyle style) =>
 Result.Error <CharInfo>(MethodNotSupported(nameof(GetCharInfo)));
Пример #8
0
 public ExtensionChar GetExtension(CharInfo charInfo, TexStyle style) =>
 throw MethodNotSupported(nameof(GetExtension));
Пример #9
0
        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);
        }
Пример #10
0
        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]);
        }
Пример #11
0
 public double GetDenom2(TexStyle style)
 {
     return GetParameter("denom2") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint;
 }
Пример #12
0
 public double GetDefaultLineThickness(TexStyle style)
 {
     return GetParameter("defaultrulethickness") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint;
 }
Пример #13
0
 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);
 }
Пример #14
0
 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));
 }
Пример #15
0
 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)));
 }
Пример #16
0
 private CharInfo GetCharInfo(ITeXFont texFont, TexStyle style) =>
 TextStyle is null
         ? texFont.GetDefaultCharInfo(Character, style)
         : texFont.GetCharInfo(Character, TextStyle, style);
Пример #17
0
 public double GetNum3(TexStyle style)
 {
     return GetParameter("num3") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint;
 }
Пример #18
0
 public Result <CharInfo> GetDefaultCharInfo(char character, TexStyle style) =>
 Result.Error <CharInfo>(MethodNotSupported(nameof(this.GetDefaultCharInfo)));
Пример #19
0
 public double GetQuad(int fontId, TexStyle style)
 {
     var fontInfo = fontInfoList[fontId];
     return fontInfo.GetQuad(GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint);
 }
Пример #20
0
 public double GetQuad(int fontId, TexStyle style) => throw MethodNotSupported(nameof(GetQuad));
Пример #21
0
 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);
 }
Пример #22
0
 public double GetAxisHeight(TexStyle style) => throw MethodNotSupported(nameof(GetAxisHeight));
Пример #23
0
 public double GetSpace(TexStyle style)
 {
     var spaceFontId = (int)generalSettings["spacefontid"];
     var fontInfo = fontInfoList[spaceFontId];
     return fontInfo.GetSpace(GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint);
 }
Пример #24
0
 public double GetNum3(TexStyle style) => throw MethodNotSupported(nameof(GetNum3));
Пример #25
0
 public double GetSupDrop(TexStyle style)
 {
     return GetParameter("supdrop") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint;
 }
Пример #26
0
 public CharInfo GetCharInfo(string symbolName, TexStyle style)
 {
     var mapping = symbolMappings[symbolName];
     if (mapping == null)
         throw new SymbolMappingNotFoundException(symbolName);
     return GetCharInfo((CharFont)mapping, style);
 }
Пример #27
0
 public double GetXHeight(TexStyle style, int fontCode)
 {
     var fontInfo = fontInfoList[fontCode];
     return fontInfo.GetXHeight(GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint);
 }
Пример #28
0
 public TexCharMetric GetCharMetric(string symbol, TexStyle style)
 {
     return(GetChar(symbol).GetMetric(TexUtility.SizeFactor(style)));
 }
Пример #29
0
 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"];
 }
Пример #30
0
 public TexEnvironment(TexStyle style, ITeXFont texFont)
     : this(style, texFont, null, null)
 {
 }
Пример #31
0
        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);
        }
Пример #32
0
 public TexEnvironment(TexStyle style, ITeXFont mathFont, ITeXFont textFont)
     : this(style, mathFont, textFont, null, null)
 {
 }
Пример #33
0
 public double GetAxisHeight(TexStyle style)
 {
     return GetParameter("axisheight") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint;
 }
Пример #34
0
 public double GetDefaultLineThickness(TexStyle style) => throw MethodNotSupported(nameof(GetDefaultLineThickness));
Пример #35
0
 public double GetBigOpSpacing4(TexStyle style)
 {
     return GetParameter("bigopspacing4") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint;
 }
Пример #36
0
 public CharInfo GetNextLargerCharInfo(CharInfo charInfo, TexStyle style) =>
 throw MethodNotSupported(nameof(GetNextLargerCharInfo));
Пример #37
0
        public double GetXHeight(TexStyle style, int fontCode)
        {
            var fontInfo = fontInfoList[fontCode];

            return(fontInfo.GetXHeight(GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint));
        }
Пример #38
0
 public Result <CharInfo> GetCharInfo(CharFont charFont, TexStyle style) =>
 Result.Error <CharInfo>(MethodNotSupported(nameof(this.GetCharInfo)));
Пример #39
0
 public double GetAxisHeight(TexStyle style)
 {
     return(GetParameter("axisheight") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint);
 }
Пример #40
0
 public double GetKern(CharFont leftChar, CharFont rightChar, TexStyle style) => 0.0;
Пример #41
0
 public double GetBigOpSpacing5(TexStyle style)
 {
     return(GetParameter("bigopspacing5") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint);
 }
Пример #42
0
 public double GetSkew(CharFont charFont, TexStyle style) => throw MethodNotSupported(nameof(GetSkew));
Пример #43
0
 public double GetSupDrop(TexStyle style)
 {
     return(GetParameter("supdrop") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint);
 }
Пример #44
0
 public double GetSpace(TexStyle style) => throw MethodNotSupported(nameof(GetSpace));
Пример #45
0
 public double GetNum3(TexStyle style)
 {
     return(GetParameter("num3") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint);
 }
Пример #46
0
 public double GetBigOpSpacing5(TexStyle style) => throw MethodNotSupported(nameof(GetBigOpSpacing5));
Пример #47
0
 public double GetDenom2(TexStyle style)
 {
     return(GetParameter("denom2") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint);
 }
Пример #48
0
 protected override Result <CharInfo> GetCharInfo(ITeXFont font, TexStyle style) =>
 font.GetCharInfo(this.Name, style);
Пример #49
0
 public double GetDefaultLineThickness(TexStyle style)
 {
     return(GetParameter("defaultrulethickness") * GetSizeFactor(style) * TexFontUtilities.PixelsPerPoint);
 }
Пример #50
0
 public double GetDenom2(TexStyle style) => throw MethodNotSupported(nameof(GetDenom2));
Пример #51
0
 protected override Result <CharInfo> GetCharInfo(ITeXFont texFont, TexStyle style) =>
 this.IsDefaultTextStyle
         ? texFont.GetDefaultCharInfo(this.Character, style)
         : texFont.GetCharInfo(this.Character, this.TextStyle, style);
Пример #52
0
 public TexRenderer GetRenderer(TexStyle style, double scale)
 {
     var environment = new TexEnvironment(style, new DefaultTexFont(scale));
     return new TexRenderer(CreateBox(environment), scale);
 }
Пример #53
0
 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);
 }