コード例 #1
0
ファイル: CharBox.cs プロジェクト: Synedh/the_m_wand
        // Unicode character (where it didn't inside our library)
        public static CharBox Get(int font, char ch)
        {
            var C = TEXPreference.main.GetChar(font, ch);

            if (C == null)
            {
                var f = TEXPreference.main.fonts[font];

                if (f.type == TexAssetType.Font)
                {
                    // unicode
                    var box = ObjPool <CharBox> .Get();

                    box.i = font;
                    var scl = TexContext.Scale;
                    var c   = box.c = ((TexFont)f).GenerateFont(ch,
                                                                (int)(TexContext.Resolution * scl) + 1, TexContext.Style.value);
                    float r = scl / c.size;
                    box.Set(-c.minY * r, c.maxY * r, -c.minX * r, c.maxX * r, c.advance * r);
                    return(box);
                }
                else
                {
                    // a sprite. simply no way to fix this!
                    throw new InvalidOperationException("Illegal Character! '" + ch + "' doesn't exist in " + TEXPreference.main.fonts[font].name);
                }
            }
            else
            {
                return(Get(C));
            }
        }
コード例 #2
0
        public static UnderOverAtom Get(Atom baseAtom, Atom underOver, float underOverSpace,
                                        bool underOverScriptSize, bool over)
        {
            var atom = ObjPool <UnderOverAtom> .Get();

            atom.BaseAtom = baseAtom;

            if (over)
            {
                atom.UnderAtom          = null;
                atom.UnderSpace         = 0;
                atom.UnderScriptSmaller = false;
                atom.OverAtom           = underOver;
                atom.OverSpace          = underOverSpace;
                atom.OverScriptSmaller  = underOverScriptSize;
            }
            else
            {
                atom.UnderAtom          = underOver;
                atom.UnderSpace         = underOverSpace;
                atom.UnderScriptSmaller = underOverScriptSize;
                atom.OverSpace          = 0;
                atom.OverAtom           = null;
                atom.OverScriptSmaller  = false;
            }
            return(atom);
        }
コード例 #3
0
        public static HorizontalBox Get(Box box)
        {
            var Box = ObjPool <HorizontalBox> .Get();

            Box.Add(box);
            return(Box);
        }
コード例 #4
0
ファイル: TexFormula.cs プロジェクト: step4/rac-quiz
        public static TexFormula Get(TexFormula formula)
        {
            var formulas = ObjPool <TexFormula> .Get();

            formulas.Add(formula);
            return(formulas);
        }
コード例 #5
0
        public static AttrColorAtom Get(string colorStr, int mix, out AttrColorAtom endBlock)
        {
            var atom = ObjPool <AttrColorAtom> .Get();

            endBlock = ObjPool <AttrColorAtom> .Get();

            atom.EndAtom = endBlock;
            atom.mix     = mix;
            endBlock.mix = mix;
            if (colorStr == null)
            {
                atom.color = Color.white;
            }
            else if (colorStr.Length == 1)
            {
                atom.color = ModifiedTerminalColor(colorStr[0]);
            }
            else if (!ColorUtility.TryParseHtmlString(colorStr, out atom.color))
            {
                if (!ColorUtility.TryParseHtmlString("#" + colorStr, out atom.color))
                {
                    atom.color = Color.white;
                }
            }
            endBlock.color = atom.color;
            return(atom);
        }
コード例 #6
0
        public static AttrTransformationAtom Get(string transformStr, int pivotMode, out AttrTransformationAtom endBlock)
        {
            var atom = ObjPool <AttrTransformationAtom> .Get();

            endBlock = ObjPool <AttrTransformationAtom> .Get();

            atom.EndAtom   = endBlock;
            atom.pivotMode = pivotMode;
            var dualIndicator = transformStr.IndexOf('|');

            atom.dualMatrix = dualIndicator >= 0;
            atom.matrix     = ParseTransformation(transformStr);
            if (atom.dualMatrix)
            {
                atom.matrix       = ParseTransformation(transformStr.Substring(0, dualIndicator));
                atom.secondMatrix = ParseTransformation(transformStr.Substring(dualIndicator + 1));
            }
            else
            {
                atom.matrix = ParseTransformation(transformStr);
            }

            endBlock.matrix    = atom.matrix;
            endBlock.pivotMode = atom.pivotMode;
            return(atom);
        }
コード例 #7
0
ファイル: StrikeBox.cs プロジェクト: Synedh/the_m_wand
        public static StrikeBox Get(float Height, float Width, float Depth)
        {
            var box = ObjPool <StrikeBox> .Get();

            box.Set(Width, Height, Depth, 0);
            return(box);
        }
コード例 #8
0
ファイル: StrutBox.cs プロジェクト: Synedh/the_m_wand
        public static StrutBox Get(float Width, float Height, float Depth, float Shift, StrutPolicy Policy)
        {
            var box = ObjPool <StrutBox> .Get();

            box.Set(Width, Height, Depth, Shift);
            box.policy = Policy;
            return(box);
        }
コード例 #9
0
        public static HorizontalRule Get(float Height, float Width, float Shift)
        {
            var box = ObjPool <HorizontalRule> .Get();

            box.Set(Width, Height, 0, Shift);
            box.useXDepth = false;
            return(box);
        }
コード例 #10
0
        public static HorizontalRule Get(float Height, float Width, float Shift, float Depth, bool UseXDepth)
        {
            var box = ObjPool <HorizontalRule> .Get();

            box.Set(Width, Height, Depth, Shift);
            box.useXDepth = UseXDepth;
            return(box);
        }
コード例 #11
0
        public static AccentedAtom Get(Atom baseAtom, Atom accent)
        {
            var atom = ObjPool <AccentedAtom> .Get();

            atom.BaseAtom   = baseAtom ?? SpaceAtom.Get(0, 0, 0);
            atom.AccentAtom = accent as SymbolAtom;
            return(atom);
        }
コード例 #12
0
ファイル: AttrStyleAtom.cs プロジェクト: Synedh/the_m_wand
        public static AttrStyleAtom Get(Atom baseAtom, FontStyle style)
        {
            var atom = ObjPool <AttrStyleAtom> .Get();

            atom.BaseAtom = baseAtom;
            atom.Style    = style;
            return(atom);
        }
コード例 #13
0
        public static AccentedAtom Get(Atom baseAtom, string accentName)
        {
            var atom = ObjPool <AccentedAtom> .Get();

            atom.BaseAtom   = baseAtom ?? SpaceAtom.Get(0, 0, 0);
            atom.AccentAtom = SymbolAtom.GetAtom(accentName);
            return(atom);
        }
コード例 #14
0
        public static UnicodeAtom Get(int FontIndex, char c)
        {
            var atom = ObjPool <UnicodeAtom> .Get();

            atom.fontIndex = FontIndex;
            atom.charIndex = c;
            return(atom);
        }
コード例 #15
0
ファイル: AttrStyleAtom.cs プロジェクト: Synedh/the_m_wand
        public static AttrStyleAtom Get(Atom baseAtom, string styleStr)
        {
            var atom = ObjPool <AttrStyleAtom> .Get();

            atom.BaseAtom = baseAtom;
            atom.Style    = ParseFontStyle(styleStr);
            return(atom);
        }
コード例 #16
0
        public static Radical Get(Atom baseAtom, Atom degreeAtom)
        {
            var atom = ObjPool <Radical> .Get();

            atom.Type       = CharTypeInternal.Inner;
            atom.BaseAtom   = baseAtom;
            atom.DegreeAtom = degreeAtom;
            return(atom);
        }
コード例 #17
0
        public static AttrTransformationBox Get(AttrTransformationAtom atom, AttrTransformationBox endBox)
        {
            var box = ObjPool <AttrTransformationBox> .Get();

            box.pivotMode    = atom.pivotMode;
            box.endBox       = endBox;
            box.attachedAtom = atom;
            return(box);
        }
コード例 #18
0
        public static AttrColorBox Get(int mixMode, Color color, AttrColorBox endBox)
        {
            var box = ObjPool <AttrColorBox> .Get();

            box.renderColor = color;
            box.mixMode     = mixMode;
            box.endBox      = endBox;
            return(box);
        }
コード例 #19
0
        public static HorizontalRule Get(float Height, float Width, float Shift)
        {
            var box = ObjPool <HorizontalRule> .Get();

            box.width  = Width;
            box.height = Height;
            box.shift  = Shift;
            return(box);
        }
コード例 #20
0
ファイル: AttrColorBox.cs プロジェクト: Synedh/the_m_wand
        public static AttrColorBox Get(int mixMode, Color color)
        {
            var box = ObjPool <AttrColorBox> .Get();

            box.color   = color;
            box.mixmode = mixMode;
            // leave the size zero
            return(box);
        }
コード例 #21
0
        public static AttrBorderAtom Get(Atom baseAtom, string param, bool margin)
        {
            var atom = ObjPool <AttrBorderAtom> .Get();

            atom.baseAtom = baseAtom;
            atom.margin   = margin;
            Parse(param, out atom.thickness, out atom.radius, out atom.color);
            return(atom);
        }
コード例 #22
0
        public static StrikeBox Get(float Height, float Width, float Depth)
        {
            var box = ObjPool <StrikeBox> .Get();

            box.width  = Width;
            box.height = Height;
            box.depth  = Depth;
            return(box);
        }
コード例 #23
0
ファイル: AttrBgAtom.cs プロジェクト: Synedh/the_m_wand
        public static AttrBgAtom Get(Atom baseAtom, string color, bool margin)
        {
            var atom = ObjPool <AttrBgAtom> .Get();

            atom.baseAtom = baseAtom;
            atom.margin   = margin;
            atom.color    = color == null ? Color.clear : AttrColorAtom.ParseColor(color);
            return(atom);
        }
コード例 #24
0
        public static CharAtom Get(char character, int FontIndex)
        {
            var atom = ObjPool <CharAtom> .Get();

            atom.Character = character;
            atom.FontIndex = FontIndex;
            atom.FontStyle = TexUtility.RenderFontStyle;
            return(atom);
        }
コード例 #25
0
ファイル: HolderAtom.cs プロジェクト: step4/rac-quiz
        public static HolderAtom Get(Atom baseAtom, Vector2 size, TexAlignment Alignment)
        {
            var atom = ObjPool <HolderAtom> .Get();

            atom.BaseAtom = baseAtom;
            atom.size     = size;
            atom.align    = Alignment;
            atom.Type     = CharTypeInternal.Inner;
            return(atom);
        }
コード例 #26
0
        public static HorizontalBox Get()
        {
            var Box = ObjPool <HorizontalBox> .Get();

            if (Box.children == null)
            {
                Box.children = new List <Box>(8);
            }
            return(Box);
        }
コード例 #27
0
        public static ScriptsAtom Get(Atom baseAtom, Atom subscriptAtom, Atom superscriptAtom)
        {
            var atom = ObjPool <ScriptsAtom> .Get();

            atom.BaseAtom        = baseAtom;
            atom.SubscriptAtom   = subscriptAtom;
            atom.SuperscriptAtom = superscriptAtom;
            atom.Type            = CharTypeInternal.Inner;
            return(atom);
        }
コード例 #28
0
        public static AttrColorBox Get(AttrColorAtom atom, AttrColorBox endBox)
        {
            var box = ObjPool <AttrColorBox> .Get();

            box.renderColor  = atom.color;
            box.mixMode      = atom.mix;
            box.endBox       = endBox;
            box.attachedAtom = atom;
            return(box);
        }
コード例 #29
0
ファイル: MatrixAtom.cs プロジェクト: Synedh/the_m_wand
        public static MatrixAtom Get()
        {
            var atom = ObjPool <MatrixAtom> .Get();

            atom.horizontalAlign = 1 + 8 + 64;
            atom.verticalAlign   = 1 + 8 + 64;
            atom.horizontalLine  = 0;
            atom.verticalLine    = 0;
            return(atom);
        }
コード例 #30
0
        public static VerticalBox Get()
        {
            var box = ObjPool <VerticalBox> .Get();

            if (box.children == null)
            {
                box.children = new List <Box>();
            }
            return(box);
        }