Exemple #1
0
        public NoForms.Common.Point HitText(int pos, bool trailing, UText text)
        {
            // Grab a ref to the sdgtextinfo
            var ti = glyphRunner.GetTextInfo(text);

            return(glyphRunner.HitText(ti, pos, trailing));
        }
Exemple #2
0
        public void DrawText(UText textObject, Point location, UBrush defBrush, UTextDrawOptions opt, bool clientRendering)
        {
            var tl = CreateTextElements(textObject);

            foreach (var ord in textObject.SafeGetStyleRanges)
            {
                if (ord.bgOverride != null)
                {
                    foreach (var r in HitTextRange(ord.start, ord.length, location, textObject))
                    {
                        FillRectangle(r, ord.bgOverride);
                    }
                }
            }

            if (clientRendering)
            {
                // set default foreground brush
                tl.textRenderer.defaultEffect.fgBrush = CreateBrush(defBrush);

                // Draw the text (foreground & background in the client renderer)
                tl.textLayout.Draw(new Object[] { location, textObject }, tl.textRenderer, location.X, location.Y);
            }
            else
            {
                // Use D2D implimentation of text layout rendering
                realRenderer.renderTarget.DrawTextLayout(D2DTr.tr(location), tl.textLayout, CreateBrush(defBrush));
            }
        }
Exemple #3
0
        public void DrawSimpleString()
        {
            UText ut = new UText("Hai", UHAlign.Left, UVAlign.Top, false, 50, 50);

            ut.font = new UFont("Arial", 12f, false, false);
            udraw.DrawText(ut, new Point(0, 0), new USolidBrush(), UTextDrawOptions.None, false);
        }
Exemple #4
0
        public UTextHitInfo HitPoint(NoForms.Common.Point hitPoint, UText text)
        {
            // Grab a ref to the sdgtextinfo
            var ti = glyphRunner.GetTextInfo(text);

            return(glyphRunner.HitPoint(ti, hitPoint));
        }
Exemple #5
0
        public Point HitText(int pos, bool trailing, UText text)
        {
            var   textLayout = CreateTextElements(text).textLayout;
            float hx, hy;
            var   htm = textLayout.HitTestTextPosition(pos, trailing, out hx, out hy);

            return(new Point(hx, hy));
        }
Exemple #6
0
        public D2D_TextElements CreateNewTextElements(UText t)
        {
            var textLayout = new TextLayout(dwFact, t.text, new TextFormat(
                                                dwFact,
                                                t.font.name,
                                                t.font.bold ? FontWeight.Bold : FontWeight.Normal,
                                                t.font.italic ? FontStyle.Italic : FontStyle.Normal,
                                                TranslateFontSize(t.font.size))
            {
                ParagraphAlignment = Translate(t.valign),
                TextAlignment      = Translate(t.halign),
                WordWrapping       = t.wrapped ? WordWrapping.Wrap : WordWrapping.NoWrap
            }, t.width, t.height);

            // Set font ranges... textLayout just created, dont worry about any leftover ranges.
            foreach (var sr in t.SafeGetStyleRanges)
            {
                var tr = new TextRange(sr.start, sr.length);
                if (sr.fontOverride != null)
                {
                    UFont ft = (UFont)sr.fontOverride;
                    textLayout.SetFontFamilyName(ft.name, tr);
                    textLayout.SetFontSize(TranslateFontSize(ft.size), tr);
                    textLayout.SetFontStyle(ft.italic ? FontStyle.Italic : FontStyle.Normal, tr);
                    textLayout.SetFontWeight(ft.bold ? FontWeight.Bold : FontWeight.Normal, tr);
                }
                if (sr.fgOverride != null || sr.bgOverride != null)
                {
                    ClientTextEffect cte = new ClientTextEffect();
                    if (sr.fgOverride != null)
                    {
                        cte.fgBrush = CreateBrush(sr.fgOverride);
                    }
                    if (sr.bgOverride != null)
                    {
                        cte.bgBrush = CreateBrush(sr.bgOverride);
                    }
                    textLayout.SetDrawingEffect(cte, tr);
                }
            }

            // Set renderer with a default brush
            var def = new USolidBrush()
            {
                color = new Color(0)
            };
            var textRenderer = new D2D_ClientTextRenderer(realRenderer.renderTarget, new ClientTextEffect()
            {
                fgBrush = CreateBrush(def)
            });

            var ret = new D2D_TextElements(textLayout, textRenderer);

            realRenderer.renderTarget.Disposed += new EventHandler <EventArgs>((o, e) => t.Invalidate());
            return(ret);
        }
Exemple #7
0
        static GLTextStore <sdg.Font> EnsureStoredData(UText ut)
        {
            var GLts = ut.Retreive() as GLTextStore <sdg.Font>;

            if (GLts.softbitbuf == null)
            {
                GLts.softbitbuf  = new sdg.Bitmap(1, 1);                    // FIXME will this cause problems @ 0x0? :/
                GLts.sbb_context = sdg.Graphics.FromImage(GLts.softbitbuf); // make context
            }
            return(GLts);
        }
Exemple #8
0
        // FIXME Cache!
        public UTextInfo GetTextInfo(UText text)
        {
            var sti = glyphRunner.GetTextInfo(text);

            return(new UTextInfo()
            {
                minSize = sti.minSize,
                lineLengths = sti.lineLengths.ToArray(),
                lineNewLineLength = sti.newLineLengths.ToArray(),
                numLines = sti.lineLengths.Count
            });
        }
Exemple #9
0
        static GLTextStore <sdg.Font> EnsureStoredData(UText ut, Size blitSize)
        {
            var GLts = ut.Retreive() as GLTextStore <sdg.Font>;

            if (GLts.softbitbuf == null || (GLts.softbitbuf.Size.Width != blitSize.width && GLts.softbitbuf.Size.Height != blitSize.height))
            {
                // make bitmap right size FIXME is the dipose necessary? :/
                GLts.sbb_context.Dispose(); GLts.softbitbuf.Dispose();
                GLts.softbitbuf  = new sdg.Bitmap((int)blitSize.width + 1, (int)blitSize.height + 1);
                GLts.sbb_context = sdg.Graphics.FromImage(GLts.softbitbuf);
            }
            return(GLts);
        }
Exemple #10
0
        public UTextInfo GetTextInfo(UText text)
        {
            var datastore = GetTextData(text);
            // ...which we will fill as necessary.
            var ti = datastore.tinfo ?? (datastore.tinfo = glyphRunner.GetTextInfo(text));

            return(new UTextInfo()
            {
                minSize = ti.minSize,
                lineLengths = ti.lineLengths.ToArray(),
                lineNewLineLength = ti.newLineLengths.ToArray(),
                numLines = ti.lineLengths.Count
            });
        }
Exemple #11
0
        // Text Measuring
        public UTextHitInfo HitPoint(Point hitPoint, UText text)
        {
            var textLayout = CreateTextElements(text).textLayout;

            SharpDXLib.Bool trailing, inside;
            var             htm = textLayout.HitTestPoint(hitPoint.X, hitPoint.Y, out trailing, out inside);

            return(new UTextHitInfo()
            {
                charPos = htm.TextPosition,
                leading = hitPoint.X > htm.Left + htm.Width / 2,
                isText = htm.IsText
            });
        }
Exemple #12
0
        public void DrawText(UText textObject, NoForms.Common.Point location, UBrush defBrush, UTextDrawOptions opt, bool clientRendering)
        {
            var tl = glyphRunner.GetTextInfo(textObject);

            foreach (var glyphrun in tl.glyphRuns)
            {
                var       style   = glyphrun.run.drawStyle;
                UFont     font    = style != null ? (style.fontOverride ?? textObject.font) : textObject.font;
                FontStyle fs      = (font.bold ? FontStyle.Bold: 0) | (font.italic ? FontStyle.Italic: 0);
                var       sdgFont = Translate(font);
                UBrush    brsh    = style != null ? (style.fgOverride ?? defBrush) : defBrush;
                if (style != null && style.bgOverride != null)
                {
                    FillRectangle(new NoForms.Common.Rectangle(glyphrun.location, glyphrun.run.runSize), style.bgOverride);
                }
                realRenderer.graphics.DrawString(glyphrun.run.content, sdgFont, CreateBrush(brsh), SDGTr.trF(location + glyphrun.location), StringFormat.GenericTypographic);
            }
        }
Exemple #13
0
        UGlyphRun BuildGlyphRun(int start, int length, UStyleRange currentStyle, UText text, BreakType bt)
        {
            FontClass useFont = Translate(currentStyle == null ? text.font : currentStyle.fontOverride ?? text.font);

            var gr = new UGlyphRun()
            {
                startPosition = start,
                runLength     = length,
                breakingType  = bt,
                drawStyle     = currentStyle,
                charSizes     = new Size[length]
            };

            float tw = 0;

            gr.content = gr.runLength > 0 ? text.text.Substring(gr.startPosition, gr.runLength) : "";
            gr.runSize = MeasureString(text, gr.content, useFont);
            if (bt == BreakType.word)
            {
                // handle space spacing ;)
                String ltx = gr.startPosition > 0 ? text.text.Substring(gr.startPosition - 1, 1) : "";
                String rtx = gr.startPosition + length < text.text.Length ? text.text.Substring(length, 1) : "";
                var    s1  = MeasureString(text, ltx + gr.content + rtx, useFont);
                var    s2  = MeasureString(text, ltx + rtx, useFont);
                gr.runSize.width = s1.width - s2.width;
            }
            for (int i = 0; i < gr.content.Length; i++)
            {
                gr.charSizes[i] = MeasureString(text, gr.content.Substring(i, 1), useFont);
                tw += gr.charSizes[i].width;
            }
            float corr = gr.runSize.width / tw;

            for (int i = 0; i < gr.content.Length; i++)
            {
                gr.charSizes[i].width *= corr;
            }

            return(gr);
        }
Exemple #14
0
        // FIXME Cache!! (most importantly)
        public UTextGlyphingInfo GetTextInfo(UText text)
        {
            // gotta do a line or end before we can decide the char tops (baseline aligned, presumably...)
            float             currX = 0, currY = 0, maxGlyphHeight = 0;
            int               lglst         = 0;  // last glyphrun line start
            int               lastWordBreak = -1; // last wordbreaking glyph on the current line
            int               currLine      = 0;
            UTextGlyphingInfo ret           = new UTextGlyphingInfo();

            // begin on assumption we're top left align..then correct after
            UGlyphRun lastGr = null;

            foreach (var gr in GetGlyphRuns(text))
            {
                // tracking max height for the line baselineing
                maxGlyphHeight = Math.Max(gr.runSize.height, maxGlyphHeight);
                // whichever way, this line is this many chars longer

                // Potential runs include words, spaces and linebreaks, and font breaks
                if (gr.breakingType == BreakType.line)
                {//LineBreaking
                    // add the glyphrun, resolve info for the line, and begin on new line!
                    ret.glyphRuns.Add(new UGlyphRunLayoutInfo()
                    {
                        lineNumber = currLine,
                        location   = new Point(currX, 0), // dunno about y position yet
                        run        = gr
                    });

                    currY         += maxGlyphHeight;
                    maxGlyphHeight = 0;
                    lastWordBreak  = -1;
                    float xAlighnShifty = GetShift(text.width, (currX + gr.runSize.width), text.halign);
                    currX = 0;

                    // resolving the glyphruns of this line
                    do
                    {
                        var igr = ret.glyphRuns[lglst];
                        igr.location = new Point(igr.location.X + xAlighnShifty, currY - igr.run.runSize.height);
                    } while (++lglst < ret.glyphRuns.Count);

                    // begin a new line
                    currLine++;
                }
                else if (lastWordBreak > -1 && currX + gr.runSize.width > text.width && text.wrapped)
                {// WordWrapping
                    // Must define the concept of glyph groups here.  Those between line and/or word breaks.
                    // The whole of such a group must be broken.  We need to define the breaking glyph.
                    currY         += maxGlyphHeight;
                    maxGlyphHeight = 0;
                    currX          = 0;
                    // #1 Is there a word break previous to this glyphrun on this line?
                    //    then put all glyphs following that on the next line.
                    for (int i = lastWordBreak + 1; i < ret.glyphRuns.Count; i++)
                    {
                        ret.glyphRuns[i].lineNumber++;
                        ret.glyphRuns[i].location = new Point(currX, 0);
                    }
                    lastWordBreak = -1;
                    currLine++;

                    // Is this glyphrun a wordbreak? who cares, next iteration will take care via #1.
                    // Not wordbreak? no prev worbreak? who cares, carry on.
                    ret.glyphRuns.Add(new UGlyphRunLayoutInfo()
                    {
                        lineNumber = currLine,
                        location   = new Point(currX, 0), // dunno about y position yet
                        run        = gr
                    });

                    // resolving the glyphruns of the last line
                    do
                    {
                        var igr = ret.glyphRuns[lglst];
                        igr.location = new Point(igr.location.X, currY - igr.run.runSize.height);
                    } while (++lglst <= lastWordBreak);
                    lastGr = gr;
                }
                else
                {// Buisness as Normal
                    // add glyphrun, increment currX
                    ret.glyphRuns.Add(new UGlyphRunLayoutInfo()
                    {
                        lineNumber = currLine,
                        location   = new Point(currX, 0),
                        run        = gr
                    });
                    if (gr.breakingType == BreakType.word)
                    {
                        lastWordBreak = ret.glyphRuns.Count - 1;
                    }
                    currX += gr.runSize.width;
                }
            }
            currY         += maxGlyphHeight;
            maxGlyphHeight = 0;
            lastWordBreak  = -1;
            float lastXShift = GetShift(text.width, (currX + (lastGr == null ? 0 :lastGr.runSize.width)), text.halign);

            currX = 0;
            // resolving the glyphruns of the final line
            for (; lglst < ret.glyphRuns.Count; lglst++)
            {
                var igr = ret.glyphRuns[lglst];
                igr.location.Y  = currY - igr.run.runSize.height;
                igr.location.X += lastXShift;
            }

            float yAlignShifty = GetShift(text.height, currY, text.valign);

            // assign the linelengths to textinfo and do y alignment
            int   cl = 0; int cc = 0; int cnl = 0;
            float cx = 0, cy = 0, maxy = 0, maxx = 0;

            for (int i = 0; i < ret.glyphRuns.Count; i++)
            {
                var gri = ret.glyphRuns[i];
                gri.location.Y += yAlignShifty;
                if (gri.lineNumber > cl)
                {
                    // add lineinfo (and reset counters)
                    cl = gri.lineNumber;
                    ret.lineLengths.Add(cc);
                    ret.newLineLengths.Add(cl);
                    ret.lineSizes.Add(new Size(cx, maxy));
                    cc   = cnl = 0;
                    cy  += maxy;
                    maxx = Math.Max(maxx, cx);
                    maxy = cx = 0;
                }

                // Continue adding lineinfo data
                cc += gri.run.runLength;
                cx += gri.run.runSize.width;
                if (gri.run.breakingType == BreakType.line)
                {
                    cnl += gri.run.runLength;
                }
                maxy = Math.Max(gri.run.runSize.height, maxy);
            }
            ret.minSize = new Size(maxx, cy);
            return(ret);
        }
Exemple #15
0
        static String[] lineBreak = new String[] { "\r\n", "\n" }; //order is important
        IEnumerable <UGlyphRun> GetGlyphRuns(UText text)
        {
            // concecutive wordbreaks are one glyphrun, while concecutive linebreaks are individual glpyhruns
            List <TR> breaks = new List <TR>();

            foreach (String lb in lineBreak)
            {
                foreach (int idx in AllIndexes(text.text, lb))
                {
                    breaks.Add(new TR()
                    {
                        type = BreakType.line, content = lb, location = idx
                    });
                }
            }
            int lastIdx = -2;

            foreach (String wb in wordBreak)
            {
                foreach (int idx in AllIndexes(text.text, wb))
                {
                    if (idx == lastIdx + 1) // inflate last break
                    {
                        breaks[breaks.Count - 1].content += wb;
                    }
                    else
                    {
                        breaks.Add(new TR()
                        {
                            type = BreakType.word, content = wb, location = idx
                        });
                    }
                }
            }

            int         cpos   = 0;
            UStyleRange cstyle = null;
            bool        flatch = true;

            // splitting glyphs also by changes in UStyleRange
            var srs = new List <UStyleRange>(text.SafeGetStyleRanges);

            foreach (var sr in NormaliseStyleRanges(srs, text.text.Length))
            {
                var lsi = sr.leftStlyeIdx;
                var rsi = sr.rightStyleIdx;
                var tr  = new TR()
                {
                    type     = BreakType.font,
                    content  = "",
                    location = sr.splitPoint,
                    styley   = new UStyleRange[]
                    {
                        lsi > -1 ? srs[lsi] : null,
                        rsi > -1 ? srs[rsi] : null
                    }
                };
                breaks.Add(tr);
                if (flatch)
                {
                    cstyle = tr.styley[0];
                    flatch = false;
                }
            }

            // Sort those breaks... FIXME sorting is slow
            breaks.Sort((a, b) =>
            {
                var lb = a.location.CompareTo(b.location);
                return(lb == 0 ? a.content.Length.CompareTo(b.content.Length) : lb);
            });

            // build glyphruns from the breaks...
            foreach (var tr in breaks)
            {
                // two glyphruns in this, first is before the break (could be zero length)
                yield return(BuildGlyphRun(cpos, tr.location - cpos, cstyle, text, BreakType.none));

                // next is the break itself, dont add font breaks (geting dirty here)
                if (tr.type == BreakType.font)
                {
                    cstyle = tr.styley[1];
                }
                else
                {
                    yield return(BuildGlyphRun(tr.location, tr.content.Length, cstyle, text, tr.type));
                }

                // cpos set to after the break
                cpos = tr.location + tr.content.Length;
            }

            // possible last glyphrun
            if (cpos < text.text.Length)
            {
                yield return(BuildGlyphRun(cpos, text.text.Length - cpos, cstyle, text, BreakType.none));
            }
        }
Exemple #16
0
 public D2D_TextElements CreateTextElements(UText t)
 {
     return(t.Retreive <SharpDX_RenderElements>(new NoCacheDelegate(() => CreateNewTextElements(t))) as D2D_TextElements);
 }
Exemple #17
0
        public UTextHitInfo HitPoint(NoForms.Common.Point hitPoint, UText text)
        {
            var ti = GetTextData(text);

            return(glyphRunner.HitPoint(ti.tinfo, hitPoint));
        }
Exemple #18
0
 GLTextStore <sdg.Font> GetTextData(UText text)
 {
     // On NoCache, just return an uninitialised dude...
     return(text.Retreive <OTKDraw>(() => new GLTextStore <sdg.Font>()) as GLTextStore <sdg.Font>);
 }
Exemple #19
0
        public IEnumerable <NoForms.Common.Rectangle> HitTextRange(int start, int length, NoForms.Common.Point offset, UText text)
        {
            var ti = GetTextData(text);

            return(glyphRunner.HitTextRange(ti.tinfo, start, length, offset));
        }
Exemple #20
0
        public NoForms.Common.Point HitText(int pos, bool trailing, UText text)
        {
            var ti = GetTextData(text);

            return(glyphRunner.HitText(ti.tinfo, pos, trailing));
        }
Exemple #21
0
        public IEnumerable <Rectangle> HitTextRange(int start, int length, Point offset, UText text)
        {
            var textLayout = CreateTextElements(text).textLayout;

            foreach (var htm in textLayout.HitTestTextRange(start, length, offset.X, offset.Y))
            {
                yield return(new Rectangle(htm.Left, htm.Top, htm.Width, htm.Height));
            }
        }
Exemple #22
0
        public void DrawText(UText textObject, NoForms.Common.Point location, UBrush defBrush, UTextDrawOptions opt, bool clientRendering)
        {
            GLTextStore <sdg.Font> GLds = GetTextData(textObject);

            //when uninitialised, all members wll be null/-1.  we need to run a pass of the generator thing
            if (GLds.texture_for_blitting == -1)
            {
                var   tl = GLds.tinfo = glyphRunner.GetTextInfo(textObject);
                float l = float.MaxValue, t = float.MaxValue, b = float.MinValue, r = float.MinValue;

                // if empty
                if (tl.glyphRuns.Count == 0)
                {
                    return;
                }

                // Calculate the render rectangle
                foreach (var gr in tl.glyphRuns)
                {
                    var p1 = gr.location;
                    var p2 = new Point(p1.X + gr.run.runSize.width, p1.Y + gr.run.runSize.height);
                    if (p1.X < l)
                    {
                        l = p1.X;
                    }
                    if (p2.X < l)
                    {
                        l = p2.X;
                    }
                    if (p1.Y < t)
                    {
                        t = p1.Y;
                    }
                    if (p2.Y < t)
                    {
                        t = p2.Y;
                    }
                    if (p2.X > r)
                    {
                        r = p2.X;
                    }
                    if (p1.X > r)
                    {
                        r = p1.X;
                    }
                    if (p2.Y > b)
                    {
                        b = p2.Y;
                    }
                    if (p1.Y > b)
                    {
                        b = p1.Y;
                    }
                }
                Rectangle rrect = new Rectangle(new Point(l, t), new Point(r, b), true);
                System.Diagnostics.Debug.Assert(rrect.width > 0 && rrect.height > 0);

                // ensure we have the software buffer
                EnsureStoredData(textObject, new Size(r - l, b - t));
                // we will draw black onto transparent background, and handle brushes when rendering to blitting texture
                GLds.renderOffset = new Point(l, t);
                GLds.sbb_context.Clear(sdg.Color.Transparent);
                foreach (var glyphrun in tl.glyphRuns)
                {
                    var           style   = glyphrun.run.drawStyle;
                    UFont         font    = style != null ? (style.fontOverride ?? textObject.font) : textObject.font;
                    sdg.FontStyle fs      = (font.bold ? sdg.FontStyle.Bold : 0) | (font.italic ? sdg.FontStyle.Italic : 0);
                    var           sdgFont = FTR(font);

                    // render at 0,0 because we cropped to the minimum drawing area of glyphs...
                    GLds.sbb_context.DrawString(glyphrun.run.content, sdgFont, sdg.Brushes.Black, PTR(glyphrun.location - GLds.renderOffset), sdg.StringFormat.GenericTypographic);
                }

                // now copy into the blit mask
                GLds.texture_for_blitting = GL.GenTexture();
                LoadBitmapIntoTexture(GLds.texture_for_blitting, GLds.softbitbuf);
            }

            // draw background...
            foreach (var glyphrun in GLds.tinfo.glyphRuns)
            {
                var    style = glyphrun.run.drawStyle;
                UBrush brsh  = style != null ? (style.fgOverride ?? defBrush) : defBrush;
                if (style != null && style.bgOverride != null)
                {
                    FillRectangle(new NoForms.Common.Rectangle(location + glyphrun.location + GLds.renderOffset, glyphrun.run.runSize), style.bgOverride);
                }
            }

            // use blit mask to create a blitting texture, using the Util fbo (FIXME? but no multithreads...)
            //throw new NotImplementedException();

            // blit the buffer (FIXME thats not blitting) FIXME needs seperate (what about masked tezture alpbas!)
            var       gs = GLds.softbitbuf.Size;
            Rectangle rr = new Rectangle(location + GLds.renderOffset, new Size(gs.Width, gs.Height));
            int       st = rel.renderData.sofwareBuffer.Count;

            bufferTexRect(rr, new Rectangle(0, 0, 1, 1));
            int cnt = rel.renderData.sofwareBuffer.Count - st;

            rel.renderData.bufferInfo.Add(new RenderInfo(st, cnt, ArrayData.Vertex | ArrayData.Color | ArrayData.Texture, PrimitiveType.Quads, GLds.texture_for_blitting));
        }
Exemple #23
0
        public IEnumerable <NoForms.Common.Rectangle> HitTextRange(int start, int length, NoForms.Common.Point offset, UText text)
        {
            // Grab a ref to the sdgtextinfo
            var ti = glyphRunner.GetTextInfo(text);

            return(glyphRunner.HitTextRange(ti, start, length, offset));
        }
Exemple #24
0
        public UTextInfo GetTextInfo(UText text)
        {
            var textLayout = CreateTextElements(text).textLayout;

            return(NewTextInfo(textLayout));
        }
Exemple #25
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        Init(property);

        Rect rect = position;

        rect.height = EditorGUIUtility.singleLineHeight;

        EditorGUI.LabelField(rect, "Character", EditorStyles.boldLabel);
        rect.y += rect.height + EditorGUIUtility.standardVerticalSpacing;
        ++EditorGUI.indentLevel;
        {
            Font font = m_Font.objectReferenceValue as Font;
            rect.height = m_FontFieldfHeight;

            // 字库选择
            EditorGUI.BeginChangeCheck();
            m_choiceIndex = EditorGUI.Popup(rect, "字库", m_choiceIndex, m_aliases);
            rect.x       += 100f;
            EditorGUI.LabelField(rect, m_aliases[m_choiceIndex]);
            m_FontAlias.stringValue = m_aliases[m_choiceIndex];
            rect.x -= 100f;

            if (EditorGUI.EndChangeCheck())
            {
                SerializedObject serializedObject = m_FontAlias.serializedObject;
                for (int i = 0, iMax = serializedObject.targetObjects.Length; i < iMax; ++i)
                {
                    UText utext = serializedObject.targetObjects[i] as UText;
                    if (utext != null)
                    {
                        utext.UpdateFontData();
                    }
                }
            }

            rect.y     += rect.height + EditorGUIUtility.standardVerticalSpacing;
            rect.height = m_FontStyleHeight;
            using (new EditorGUI.DisabledScope(!m_Font.hasMultipleDifferentValues && font != null && !font.dynamic))
            {
                EditorGUI.PropertyField(rect, m_FontStyle);
            }

            rect.y     += rect.height + EditorGUIUtility.standardVerticalSpacing;
            rect.height = m_FontSizeHeight;
            EditorGUI.PropertyField(rect, m_FontSize);

            rect.y     += rect.height + EditorGUIUtility.standardVerticalSpacing;
            rect.height = m_LineSpacingHeight;
            EditorGUI.PropertyField(rect, m_LineSpacing);

            rect.y     += rect.height + EditorGUIUtility.standardVerticalSpacing;
            rect.height = m_EncodingHeight;
            EditorGUI.PropertyField(rect, m_SupportEncoding, Styles.m_EncodingContent);
        }
        --EditorGUI.indentLevel;

        rect.y     += rect.height + EditorGUIUtility.standardVerticalSpacing;
        rect.height = EditorGUIUtility.singleLineHeight;
        EditorGUI.LabelField(rect, "Paragraph", EditorStyles.boldLabel);
        rect.y += rect.height + EditorGUIUtility.standardVerticalSpacing;
        ++EditorGUI.indentLevel;
        {
            rect.height = EditorGUIUtility.singleLineHeight;
            DoTextAligmentControl(rect, m_Alignment);

            rect.y     += rect.height + EditorGUIUtility.standardVerticalSpacing;
            rect.height = m_HorizontalOverflowHeight;
            EditorGUI.PropertyField(rect, m_AlignByGeometry);

            rect.y     += rect.height + EditorGUIUtility.standardVerticalSpacing;
            rect.height = m_HorizontalOverflowHeight;
            EditorGUI.PropertyField(rect, m_HorizontalOverflow);

            rect.y     += rect.height + EditorGUIUtility.standardVerticalSpacing;
            rect.height = m_VerticalOverflowHeight;
            EditorGUI.PropertyField(rect, m_VerticalOverflow);

            rect.y     += rect.height + EditorGUIUtility.standardVerticalSpacing;
            rect.height = m_ResizeTextMaxSizeHeight;
            EditorGUI.PropertyField(rect, m_ResizeTextForBestFit);

            if (m_ResizeTextForBestFit.boolValue)
            {
                rect.y     += rect.height + EditorGUIUtility.standardVerticalSpacing;
                rect.height = m_ResizeTextMinSizeHeight;
                EditorGUI.PropertyField(rect, m_ResizeTextMinSize);

                rect.y     += rect.height + EditorGUIUtility.standardVerticalSpacing;
                rect.height = m_ResizeTextMaxSizeHeight;
                EditorGUI.PropertyField(rect, m_ResizeTextMaxSize);
            }
        }
        --EditorGUI.indentLevel;
    }
    void setSpecialObjPlane(soloItem item)
    {
        specialItem = item;
        if (m_uplane != null)
        {
            m_uplane.Destroy();
        }

        string str = "right,error,overdate";

        if (btnList.Count == 0)
        {
            foreach (var number in MyCommon.RandomRepeat(3))
            {
                btnList.Add(str.Split(',')[number]);
            }
        }

        m_uplane = new UPlane();                             //定义UI
        m_uplane.SetAnchored(AnchoredPosition.center);       //定义位置远点
        m_uplane.rect = new Rect(65, 0, 1620, 1080 / 6 * 5); //定义显示框的位置的大小
        m_uplane.gameObejct.AddComponent <ToggleGroup>();    //副节点
        m_uplane.color = new Color(0.9f, 0.9f, 0.9f);
        m_uplane.LoadImage("");

        UText m_utext = new UText();

        m_utext.SetAnchored(AnchoredPosition.center);
        m_utext.text = "请选择正确物品";
        m_utext.rect = new Rect(100, -375, 500, 100);
        m_utext.baseText.fontSize = 55;
        m_utext.baseText.color    = Color.white;
        m_utext.SetParent(m_uplane);

        for (int i = 0; i < btnList.Count; i++)
        {
            UPageButton btn = new UPageButton();
            btn.SetParent(m_uplane);
            btn.name = btnList[i];
            btn.SetAnchored(AnchoredPosition.center);
            btn.rect = new Rect(-540 + i * 500 + 50, 9, 500, 300);
            btn.LoadSprite("check_anesthetic_3");
            btn.LoadPressSprite("check_anesthetic_3_h");
            btn.onClick.AddListener(() => { OnImageButtonClick(btn); });

            UText m_datetext_1 = new UText();
            m_datetext_1.SetAnchored(AnchoredPosition.center);
            m_datetext_1.SetParent(m_uplane);
            m_datetext_1.rect = new Rect(-300 + i * 500 + 50, 240, 500, 300);
            m_datetext_1.baseText.fontSize = 23;
            m_datetext_1.baseText.color    = new Color(0f, 0f, 0f);

            m_datetext_1.rectTransform.localEulerAngles = new Vector3(0f, 0f, 5.6f);
            m_datetext_1.baseText.raycastTarget         = false;
            UText m_type_1 = new UText();

            m_type_1.SetAnchored(AnchoredPosition.center);
            m_type_1.SetParent(m_uplane);
            m_type_1.rect           = new Rect(-300 + i * 500 + 50, 200, 500, 300);
            m_type_1.baseText.color = new Color(0f, 0f, 0f);
            m_type_1.rectTransform.localEulerAngles = new Vector3(0f, 0f, 5.6f);
            m_type_1.baseText.fontSize      = 23;
            m_type_1.baseText.raycastTarget = false;
            if (btnList[i] == "right")
            {
                m_datetext_1.text = "有效日期: " + (DateTime.Now.Year + 2).ToString() + "年" + (DateTime.Now.Month.ToString()) + "月1日";
                m_type_1.text     = "规格:16Fr        ";
            }
            else
            {
                if (btnList[i] == "error")
                {
                    m_datetext_1.text = "有效日期: " + (DateTime.Now.Year + 2).ToString() + "年" + (DateTime.Now.Month.ToString()) + "月1日";
                    m_type_1.text     = "规格:8Fr\0\0\0\0\0\0\0\0";
                }
                else
                {
                    m_type_1.text     = "规格:16Fr\r\r\r\r\r\r   ";
                    m_datetext_1.text = "有效日期: " + (DateTime.Now.Year - 1).ToString() + "年" + (DateTime.Now.Month.ToString()) + "月1日";
                }
            }
        }


        UFinishButton OkButton = new UFinishButton("确定", new Rect(23, 363, 180, 70), AnchoredPosition.center);

        OkButton.SetParent(m_uplane);
        OkButton.baseButton.onClick.AddListener(specialItemChoose);

        m_uplane.transform.SetAsLastSibling();
        List <UPageBase> list = m_uplane.GetChildren();

        foreach (UPageBase upb in list)
        {
            UToogleItem tmp = null;
            try
            {
                tmp = (UToogleItem)upb;
            }
            catch
            {
                continue;
            }

            if (tmp != null)
            {
                upb.gameObejct.GetComponent <Toggle>().isOn = false;
            }
        }
        m_uplane.gameObejct.SetActive(true);
        UPageBase.FindPage("ChooseGoodsUI/ChooseItems/chooseItemFinishButton").gameObejct.SetActive(false);
        //GameObject.Find("Canvas").transform.Find("ChooseItems/UPageButton").gameObject.SetActive(false);
    }