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

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

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