// 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)); } }
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); }
public static HorizontalBox Get(Box box) { var Box = ObjPool <HorizontalBox> .Get(); Box.Add(box); return(Box); }
public static TexFormula Get(TexFormula formula) { var formulas = ObjPool <TexFormula> .Get(); formulas.Add(formula); return(formulas); }
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); }
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); }
public static StrikeBox Get(float Height, float Width, float Depth) { var box = ObjPool <StrikeBox> .Get(); box.Set(Width, Height, Depth, 0); return(box); }
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); }
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); }
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); }
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); }
public static AttrStyleAtom Get(Atom baseAtom, FontStyle style) { var atom = ObjPool <AttrStyleAtom> .Get(); atom.BaseAtom = baseAtom; atom.Style = style; return(atom); }
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); }
public static UnicodeAtom Get(int FontIndex, char c) { var atom = ObjPool <UnicodeAtom> .Get(); atom.fontIndex = FontIndex; atom.charIndex = c; return(atom); }
public static AttrStyleAtom Get(Atom baseAtom, string styleStr) { var atom = ObjPool <AttrStyleAtom> .Get(); atom.BaseAtom = baseAtom; atom.Style = ParseFontStyle(styleStr); return(atom); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
public static HorizontalBox Get() { var Box = ObjPool <HorizontalBox> .Get(); if (Box.children == null) { Box.children = new List <Box>(8); } return(Box); }
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); }
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); }
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); }
public static VerticalBox Get() { var box = ObjPool <VerticalBox> .Get(); if (box.children == null) { box.children = new List <Box>(); } return(box); }