FairyGUI對(duì)TextMeshPro的fallback font的支持

最近項(xiàng)目中某些文字效果,使用TextMeshPro能更好剑辫、更快速的實(shí)現(xiàn)民假,看FairyGUI對(duì)TextMeshPro也有了支持板甘,就決定使用了橱夭。項(xiàng)目中涉及多語(yǔ)言,但給的字體庫(kù)不支持中文,只能使用備用字體庫(kù),看TMP中有個(gè)Fallback Font Assets(如圖1-1),以為就可以這么愉快的搞定了庐船,奈何FairyGUI并不支持這個(gè)特性,求助FairyGUI官網(wǎng)群也無(wú)果嘲更,只能自己解決了筐钟。

圖 1-1 Fallback Font Assets

看了一下UGUI中對(duì)這一特性的支持,它就是額外創(chuàng)建了一個(gè)TMP_SubMeshUI使用備用字體繪制文本赋朦。

圖 1-2 UGUI中對(duì)TMP Fallback的支持?

(1)參照這個(gè)思路篓冲,在FairyGUI中創(chuàng)建一個(gè)GSubTextField使用備用字體繪制文本,GSubTextField基本上就是GTextField的拷貝宠哄,只是對(duì)Setup_BeforeAdd做了一些改動(dòng)壹将,當(dāng)創(chuàng)建GSubTextField時(shí),完全用GTextField的各種屬性設(shè)置GSubTextField琳拨。由于TMP_FontAsset中的fallbackFontAssets為私有屬性無(wú)法訪問(wèn)瞭恰,我直接在GSubTextField中手動(dòng)設(shè)置了備用字體屯曹。代碼如下:

public void Setup_BeforeAdd(TextFormat ptf, GTextField gtf)

? ? ? ? {

? ? ? ? ? ? SetXY(gtf.x, gtf.y);

? ? ? ? ? ? SetSize(gtf.width, gtf.height, true);

? ? ? ? ? ? minWidth = gtf.minWidth;

? ? ? ? ? ? maxWidth = gtf.maxWidth;

? ? ? ? ? ? minHeight = gtf.minHeight;

? ? ? ? ? ? maxHeight = gtf.maxHeight;

? ? ? ? ? ? SetScale(gtf.scaleX, gtf.scaleY);

? ? ? ? ? ? this.skew = gtf.skew;

? ? ? ? ? ? SetPivot(gtf.pivot.x, gtf.pivot.y, gtf.pivotAsAnchor);

? ? ? ? ? ? this.alpha = gtf.alpha;

? ? ? ? ? ? this.rotation = gtf.rotation;

? ? ? ? ? ? this.visible = gtf.visible;

? ? ? ? ? ? this.touchable = false;

? ? ? ? ? ? this.grayed = gtf.grayed;

? ? ? ? ? ? this.blendMode = gtf.blendMode;

? ? ? ? ? ? TextFormat tf = _textField.textFormat;

? ? ? ? ? ? tf.font = UIConfig.defaultFont;

? ? ? ? ? ? tf.size = ptf.size;

? ? ? ? ? ? tf.color = ptf.color;

? ? ? ? ? ? this.align = gtf.align;

? ? ? ? ? ? this.verticalAlign = gtf.verticalAlign;

? ? ? ? ? ? tf.lineSpacing = ptf.lineSpacing;

? ? ? ? ? ? tf.letterSpacing = ptf.letterSpacing;

? ? ? ? ? ? _ubbEnabled = gtf.UBBEnabled;

? ? ? ? ? ? this.autoSize = gtf.autoSize;

? ? ? ? ? ? tf.underline = ptf.underline;

? ? ? ? ? ? tf.italic = ptf.italic;

? ? ? ? ? ? tf.bold = ptf.bold;

? ? ? ? ? ? this.singleLine = gtf.singleLine;

? ? ? ? ? ? tf.outlineColor = ptf.outlineColor;

? ? ? ? ? ? tf.outline = ptf.outline;

? ? ? ? ? ? tf.shadowColor = ptf.shadowColor;

? ? ? ? ? ? tf.shadowOffset = new Vector2(ptf.shadowOffset.x, ptf.shadowOffset.y);

? ? ? ? ? ? if(gtf.templateVars != null)

? ? ? ? ? ? ? ? _templateVars = new Dictionary<string, string>();

? ? ? ? ? ? tf.strikethrough = ptf.strikethrough;

? ? ? ? ? ? tf.faceDilate = ptf.faceDilate;

? ? ? ? ? ? tf.outlineSoftness = ptf.outlineSoftness;

? ? ? ? ? ? tf.underlaySoftness = ptf.underlaySoftness;

? ? ? ? ? ? _textField.textFormat = tf;

? ? ? ? ? ? SetUnderlayDilate(ptf.underlayDilate);

? ? ? ? }

(2)GTextField中實(shí)現(xiàn)創(chuàng)建GSubTextField的接口和刷新文字的接口:如下所示:

#if FAIRYGUI_TMPRO

? ? ? ? public void CreateSubTextField()

? ? ? ? {

? ? ? ? ? ? if (_subGTextField == null)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? _subGTextField = new GSubTextField();

? ? ? ? ? ? ? ? _subGTextField.Setup_BeforeAdd(_textField.textFormat, this);

? ? ? ? ? ? ? ? _subGTextField.relations.CopyFrom(this.relations);

? ? ? ? ? ? ? ? if (parent!=null)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? parent.AddChild(_subGTextField);

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? }

? ? ? ? public void RefreshSubText()

? ? ? ? {

? ? ? ? ? ? if (_subGTextField != null)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? if (_text.Equals(_subGTextField.text) == false)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? _subGTextField.text = _text;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? }

#endif

(3)FairyGUI中每次修改文本時(shí)都會(huì)調(diào)用TextField中的BuildLines2()重新構(gòu)建字符狱庇,我們?cè)谶@個(gè)接口中根據(jù)文本需不需要備用字體來(lái)決定是否需要?jiǎng)?chuàng)建GSubTextField及刷不刷新GSubTextField的文本,實(shí)現(xiàn)如下:

void BuildLines2()

? ? ? ? {

? ? ? ? ? ? float letterSpacing = _textFormat.letterSpacing * _fontSizeScale;

? ? ? ? ? ? float lineSpacing = (_textFormat.lineSpacing - 1) * _fontSizeScale;

? ? ? ? ? ? float rectWidth = _contentRect.width - GUTTER_X * 2;

? ? ? ? ? ? float glyphWidth = 0, glyphHeight = 0, baseline = 0;

#if FAIRYGUI_TMPRO

? ? ? ? ? ? bool isFallback;

? ? ? ? ? ? bool fallback = false;

#endif

? ? ? ? ? ? short wordLen = 0;

? ? ? ? ? ? bool wordPossible = false;

? ? ? ? ? ? float posx = 0;

? ? ? ? ? ? TextFormat format = _textFormat;

? ? ? ? ? ? _font.SetFormat(format, _fontSizeScale);

? ? ? ? ? ? bool wrap = _wordWrap && !_singleLine;

? ? ? ? ? ? if (_maxWidth > 0)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? wrap = true;

? ? ? ? ? ? ? ? rectWidth = _maxWidth - GUTTER_X * 2;

? ? ? ? ? ? }

? ? ? ? ? ? _textWidth = _textHeight = 0;

? ? ? ? ? ? RequestText();

? ? ? ? ? ? int elementCount = _elements.Count;

? ? ? ? ? ? int elementIndex = 0;

? ? ? ? ? ? HtmlElement element = null;

? ? ? ? ? ? if (elementCount > 0)

? ? ? ? ? ? ? ? element = _elements[elementIndex];

? ? ? ? ? ? int textLength = _parsedText.Length;

? ? ? ? ? ? LineInfo line = LineInfo.Borrow();

? ? ? ? ? ? _lines.Add(line);

? ? ? ? ? ? line.y = line.y2 = GUTTER_Y;

? ? ? ? ? ? sLineChars.Clear();

? ? ? ? ? ? for (int charIndex = 0; charIndex < textLength; charIndex++)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? char ch = _parsedText[charIndex];

? ? ? ? ? ? ? ? glyphWidth = glyphHeight = baseline = 0;

? ? ? ? ? ? ? ? while (element != null && element.charIndex == charIndex)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? if (element.type == HtmlElementType.Text)

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? format = element.format;

? ? ? ? ? ? ? ? ? ? ? ? _font.SetFormat(format, _fontSizeScale);

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? IHtmlObject htmlObject = element.htmlObject;

? ? ? ? ? ? ? ? ? ? ? ? if (_richTextField != null && htmlObject == null)

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? element.space = (int)(rectWidth - line.width - 4);

? ? ? ? ? ? ? ? ? ? ? ? ? ? htmlObject = _richTextField.htmlPageContext.CreateObject(_richTextField, element);

? ? ? ? ? ? ? ? ? ? ? ? ? ? element.htmlObject = htmlObject;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? if (htmlObject != null)

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? glyphWidth = htmlObject.width + 2;

? ? ? ? ? ? ? ? ? ? ? ? ? ? glyphHeight = htmlObject.height;

? ? ? ? ? ? ? ? ? ? ? ? ? ? baseline = glyphHeight * IMAGE_BASELINE;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? if (element.isEntity)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ch = '\0'; //indicate it is a place holder

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? elementIndex++;

? ? ? ? ? ? ? ? ? ? if (elementIndex < elementCount)

? ? ? ? ? ? ? ? ? ? ? ? element = _elements[elementIndex];

? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? element = null;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? if (ch == '\0' || ch == '\n')

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? wordPossible = false;

? ? ? ? ? ? ? ? }

#if FAIRYGUI_TMPRO

? ? ? ? ? ? ? ? else if (_font.GetGlyphWithFallback(ch == '\t' ? ' ' : ch, out glyphWidth, out glyphHeight, out baseline,out isFallback))

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? if ((isFallback == true)&&(this.gOwner!=null))

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? if(this.gOwner.GetType()==typeof(GTextField))

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? fallback = true;

? ? ? ? ? ? ? ? ? ? ? ? ? ? if(isFirst == true)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? isFirst = false;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ((GTextField)gOwner).CreateSubTextField();

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? }

#else

? ? ? ? ? ? ? ? else if (_font.GetGlyph(ch == '\t' ? ' ' : ch, out glyphWidth, out glyphHeight, out baseline))

? ? ? ? ? ? ? ? {

#endif

? ? ? ? ? ? ? ? ? ? if (ch == '\t')

? ? ? ? ? ? ? ? ? ? ? ? glyphWidth *= 4;

? ? ? ? ? ? ? ? ? ? if (wordPossible)

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? if (char.IsWhiteSpace(ch))

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? wordLen = 0;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? else if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z'

? ? ? ? ? ? ? ? ? ? ? ? ? ? || ch >= '0' && ch <= '9'

? ? ? ? ? ? ? ? ? ? ? ? ? ? || ch == '.' || ch == '"' || ch == '\''

? ? ? ? ? ? ? ? ? ? ? ? ? ? || format.specialStyle == TextFormat.SpecialStyle.Subscript

? ? ? ? ? ? ? ? ? ? ? ? ? ? || format.specialStyle == TextFormat.SpecialStyle.Superscript

? ? ? ? ? ? ? ? ? ? ? ? ? ? || _textDirection != RTLSupport.DirectionType.UNKNOW && RTLSupport.IsArabicLetter(ch))

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? wordLen++;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? wordPossible = false;

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? else if (char.IsWhiteSpace(ch))

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? wordLen = 0;

? ? ? ? ? ? ? ? ? ? ? ? wordPossible = true;

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? else if (format.specialStyle == TextFormat.SpecialStyle.Subscript

? ? ? ? ? ? ? ? ? ? ? ? || format.specialStyle == TextFormat.SpecialStyle.Superscript)

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? if (sLineChars.Count > 0)

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? wordLen = 2; //避免上標(biāo)和下標(biāo)折到下一行

? ? ? ? ? ? ? ? ? ? ? ? ? ? wordPossible = true;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? wordPossible = false;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? wordPossible = false;

? ? ? ? ? ? ? ? sLineChars.Add(new LineCharInfo() { width = glyphWidth, height = glyphHeight, baseline = baseline });

? ? ? ? ? ? ? ? if (glyphWidth != 0)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? if (posx != 0)

? ? ? ? ? ? ? ? ? ? ? ? posx += letterSpacing;

? ? ? ? ? ? ? ? ? ? posx += glyphWidth;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? if (ch == '\n' && !_singleLine)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? UpdateLineInfo(line, letterSpacing, sLineChars.Count);

? ? ? ? ? ? ? ? ? ? LineInfo newLine = LineInfo.Borrow();

? ? ? ? ? ? ? ? ? ? _lines.Add(newLine);

? ? ? ? ? ? ? ? ? ? newLine.y = line.y + (line.height + lineSpacing);

? ? ? ? ? ? ? ? ? ? if (newLine.y < GUTTER_Y) //lineSpacing maybe negative

? ? ? ? ? ? ? ? ? ? ? ? newLine.y = GUTTER_Y;

? ? ? ? ? ? ? ? ? ? newLine.y2 = newLine.y;

? ? ? ? ? ? ? ? ? ? newLine.charIndex = line.charIndex + line.charCount;

? ? ? ? ? ? ? ? ? ? sLineChars.Clear();

? ? ? ? ? ? ? ? ? ? wordPossible = false;

? ? ? ? ? ? ? ? ? ? posx = 0;

? ? ? ? ? ? ? ? ? ? line = newLine;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? else if (wrap && posx > rectWidth)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? int lineCharCount = sLineChars.Count;

? ? ? ? ? ? ? ? ? ? int toMoveChars;

? ? ? ? ? ? ? ? ? ? if (wordPossible && wordLen < 20 && lineCharCount > 2) //if word had broken, move word to new line

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? toMoveChars = wordLen;

? ? ? ? ? ? ? ? ? ? ? ? //we caculate the line width WITHOUT the tailing space

? ? ? ? ? ? ? ? ? ? ? ? UpdateLineInfo(line, letterSpacing, lineCharCount - (toMoveChars + 1));

? ? ? ? ? ? ? ? ? ? ? ? line.charCount++; //but keep it in this line.

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? toMoveChars = lineCharCount > 1 ? 1 : 0; //if only one char here, we cant move it to new line

? ? ? ? ? ? ? ? ? ? ? ? UpdateLineInfo(line, letterSpacing, lineCharCount - toMoveChars);

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? LineInfo newLine = LineInfo.Borrow();

? ? ? ? ? ? ? ? ? ? _lines.Add(newLine);

? ? ? ? ? ? ? ? ? ? newLine.y = line.y + (line.height + lineSpacing);

? ? ? ? ? ? ? ? ? ? if (newLine.y < GUTTER_Y)

? ? ? ? ? ? ? ? ? ? ? ? newLine.y = GUTTER_Y;

? ? ? ? ? ? ? ? ? ? newLine.y2 = newLine.y;

? ? ? ? ? ? ? ? ? ? newLine.charIndex = line.charIndex + line.charCount;

? ? ? ? ? ? ? ? ? ? posx = 0;

? ? ? ? ? ? ? ? ? ? if (toMoveChars != 0)

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? for (int i = line.charCount; i < lineCharCount; i++)

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? LineCharInfo ci = sLineChars[i];

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (posx != 0)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx += letterSpacing;

? ? ? ? ? ? ? ? ? ? ? ? ? ? posx += ci.width;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? sLineChars.RemoveRange(0, line.charCount);

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? sLineChars.Clear();

? ? ? ? ? ? ? ? ? ? wordPossible = false;

? ? ? ? ? ? ? ? ? ? line = newLine;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? UpdateLineInfo(line, letterSpacing, sLineChars.Count);

? ? ? ? ? ? if (_textWidth > 0)

? ? ? ? ? ? ? ? _textWidth += GUTTER_X * 2;

? ? ? ? ? ? _textHeight = line.y + line.height + GUTTER_Y;

? ? ? ? ? ? _textWidth = Mathf.RoundToInt(_textWidth);

? ? ? ? ? ? _textHeight = Mathf.RoundToInt(_textHeight);

#if FAIRYGUI_TMPRO

? ? ? ? ? ? if ((fallback==true)||(fallback != lastNeedFallback))

? ? ? ? ? ? {

? ? ? ? ? ? ? ? lastNeedFallback = fallback;

? ? ? ? ? ? ? ? ((GTextField)gOwner).RefreshSubText();

? ? ? ? ? ? }

#endif

? ? ? ? }

另外在TMPFont中添加了一個(gè)接口以便判斷文本是否需要備用字體恶耽,實(shí)現(xiàn)如下:

override public bool GetGlyphWithFallback(char ch, out float width, out float height, out float baseline,out bool isFallback)

? ? ? ? {

? ? ? ? ? ? isFallback = false;

? ? ? ? ? ? _char = GetCharacterFromFontAssetWithoutFallback(ch, _style);

? ? ? ? ? ? if (_char == null)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? _char = GetCharacterFromFontAsset(ch, _style);

? ? ? ? ? ? ? ? if(_char != null)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? isFallback = true;

? ? ? ? ? ? ? ? }? ?

? ? ? ? ? ? }

? ? ? ? ? ? if(_char != null)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? width = _char.glyph.metrics.horizontalAdvance * _boldMultiplier * _scale;

? ? ? ? ? ? ? ? height = _lineHeight * _scale;

? ? ? ? ? ? ? ? baseline = _ascent * _scale;

? ? ? ? ? ? ? ? if (_format.specialStyle == TextFormat.SpecialStyle.Subscript)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? height /= SupScale;

? ? ? ? ? ? ? ? ? ? baseline /= SupScale;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? else if (_format.specialStyle == TextFormat.SpecialStyle.Superscript)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? height = height / SupScale + baseline * SupOffset;

? ? ? ? ? ? ? ? ? ? baseline *= (SupOffset + 1 / SupScale);

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? height = Mathf.RoundToInt(height);

? ? ? ? ? ? ? ? baseline = Mathf.RoundToInt(baseline);

? ? ? ? ? ? ? ? return true;

? ? ? ? ? ? }

? ? ? ? ? ? width = 0;

? ? ? ? ? ? height = 0;

? ? ? ? ? ? baseline = 0;

? ? ? ? ? ? return false;

? ? ? ? }

? ? ? ? TMP_Character GetCharacterFromFontAssetWithoutFallback(uint unicode, FontStyles fontStyle)

? ? ? ? {

? ? ? ? ? ? bool isAlternativeTypeface;

#pragma warning disable

? ? ? ? ? ? TMP_FontAsset actualAsset;

#pragma warning restore

? ? ? ? ? ? return TMP_FontAssetUtilities.GetCharacterFromFontAsset(unicode, _fontAsset, false, fontStyle, _fontWeight,

? ? ? ? ? ? ? ? out isAlternativeTypeface

? ? ? ? ? ? //,out actualAsset //old TMP version need this line

? ? ? ? ? ? );

? ? ? ? }

(4)最后修改textField中的OnPopulateMesh密任,根據(jù)字符是否在當(dāng)前字體中決定是否繪制字形用于渲染,修改如下:

public void OnPopulateMesh(VertexBuffer vb)

? ? ? ? {

? ? ? ? ? ? if (_textWidth == 0 && _lines.Count == 1)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? if (_charPositions != null)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? _charPositions.Clear();

? ? ? ? ? ? ? ? ? ? _charPositions.Add(new CharPosition());

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? if (_richTextField != null)

? ? ? ? ? ? ? ? ? ? _richTextField.RefreshObjects();

? ? ? ? ? ? ? ? return;

? ? ? ? ? ? }

? ? ? ? ? ? float letterSpacing = _textFormat.letterSpacing * _fontSizeScale;

? ? ? ? ? ? TextFormat format = _textFormat;

? ? ? ? ? ? _font.SetFormat(format, _fontSizeScale);

? ? ? ? ? ? _font.UpdateGraphics(graphics);

? ? ? ? ? ? float rectWidth = _contentRect.width > 0 ? (_contentRect.width - GUTTER_X * 2) : 0;

? ? ? ? ? ? float rectHeight = _contentRect.height > 0 ? Mathf.Max(_contentRect.height, _font.GetLineHeight(format.size)) : 0;

? ? ? ? ? ? if (_charPositions != null)

? ? ? ? ? ? ? ? _charPositions.Clear();

? ? ? ? ? ? List<Vector3> vertList = vb.vertices;

? ? ? ? ? ? List<Vector2> uvList = vb.uvs;

? ? ? ? ? ? List<Vector2> uv2List = vb.uvs2;

? ? ? ? ? ? List<Color32> colList = vb.colors;

? ? ? ? ? ? HtmlLink currentLink = null;

? ? ? ? ? ? float linkStartX = 0;

? ? ? ? ? ? int linkStartLine = 0;

? ? ? ? ? ? float posx = 0;

? ? ? ? ? ? float indent_x;

? ? ? ? ? ? bool clipping = !_input && _autoSize == AutoSizeType.None;

? ? ? ? ? ? bool lineClipped;

? ? ? ? ? ? AlignType lineAlign;

? ? ? ? ? ? float glyphWidth, glyphHeight, baseline;

? ? ? ? ? ? bool isFallback;

? ? ? ? ? ? short vertCount;

? ? ? ? ? ? float underlineStart;

? ? ? ? ? ? float strikethroughStart;

? ? ? ? ? ? int minFontSize;

? ? ? ? ? ? int maxFontSize;

? ? ? ? ? ? string rtlLine = null;

? ? ? ? ? ? int elementIndex = 0;

? ? ? ? ? ? int elementCount = _elements.Count;

? ? ? ? ? ? HtmlElement element = null;

? ? ? ? ? ? if (elementCount > 0)

? ? ? ? ? ? ? ? element = _elements[elementIndex];

? ? ? ? ? ? int lineCount = _lines.Count;

? ? ? ? ? ? for (int i = 0; i < lineCount; ++i)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? LineInfo line = _lines[i];

? ? ? ? ? ? ? ? if (line.charCount == 0)

? ? ? ? ? ? ? ? ? ? continue;

? ? ? ? ? ? ? ? lineClipped = clipping && i != 0 && line.y + line.height > rectHeight;

? ? ? ? ? ? ? ? lineAlign = format.align;

? ? ? ? ? ? ? ? if (element != null && element.charIndex == line.charIndex)

? ? ? ? ? ? ? ? ? ? lineAlign = element.format.align;

? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? lineAlign = format.align;

? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? if (lineAlign == AlignType.Center)

? ? ? ? ? ? ? ? ? ? ? ? indent_x = (int)((rectWidth + line.width) / 2);

? ? ? ? ? ? ? ? ? ? else if (lineAlign == AlignType.Right)

? ? ? ? ? ? ? ? ? ? ? ? indent_x = rectWidth;

? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? indent_x = line.width + GUTTER_X * 2;

? ? ? ? ? ? ? ? ? ? if (indent_x > rectWidth)

? ? ? ? ? ? ? ? ? ? ? ? indent_x = rectWidth;

? ? ? ? ? ? ? ? ? ? posx = indent_x - GUTTER_X;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? if (lineAlign == AlignType.Center)

? ? ? ? ? ? ? ? ? ? ? ? indent_x = (int)((rectWidth - line.width) / 2);

? ? ? ? ? ? ? ? ? ? else if (lineAlign == AlignType.Right)

? ? ? ? ? ? ? ? ? ? ? ? indent_x = rectWidth - line.width;

? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? indent_x = 0;

? ? ? ? ? ? ? ? ? ? if (indent_x < 0)

? ? ? ? ? ? ? ? ? ? ? ? indent_x = 0;

? ? ? ? ? ? ? ? ? ? posx = GUTTER_X + indent_x;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? int lineCharCount = line.charCount;

? ? ? ? ? ? ? ? underlineStart = posx;

? ? ? ? ? ? ? ? strikethroughStart = posx;

? ? ? ? ? ? ? ? minFontSize = maxFontSize = format.size;

? ? ? ? ? ? ? ? if (_textDirection != RTLSupport.DirectionType.UNKNOW)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? rtlLine = _parsedText.Substring(line.charIndex, lineCharCount);

? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? ? ? ? ? rtlLine = RTLSupport.ConvertLineR(rtlLine);

? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? rtlLine = RTLSupport.ConvertLineL(rtlLine);

? ? ? ? ? ? ? ? ? ? lineCharCount = rtlLine.Length;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? for (int j = 0; j < lineCharCount; j++)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? int charIndex = line.charIndex + j;

? ? ? ? ? ? ? ? ? ? char ch = rtlLine != null ? rtlLine[j] : _parsedText[charIndex];

? ? ? ? ? ? ? ? ? ? while (element != null && charIndex == element.charIndex)

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? if (element.type == HtmlElementType.Text)

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? vertCount = 0;

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (format.underline != element.format.underline)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (format.underline)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (!lineClipped)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? float lineWidth;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.UNKNOW)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? lineWidth = (clipping ? Mathf.Clamp(posx, GUTTER_X, GUTTER_X + rectWidth) : posx) - underlineStart;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? lineWidth = underlineStart - (clipping ? Mathf.Clamp(posx, GUTTER_X, GUTTER_X + rectWidth) : posx);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (lineWidth > 0)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vertCount += (short)_font.DrawLine(underlineStart < posx ? underlineStart : posx, -(line.y + line.baseline), lineWidth,

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? maxFontSize, 0, vertList, uvList, uv2List, colList);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? maxFontSize = 0;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? underlineStart = posx;

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (format.strikethrough != element.format.strikethrough)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (format.strikethrough)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (!lineClipped)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? float lineWidth;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.UNKNOW)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? lineWidth = (clipping ? Mathf.Clamp(posx, GUTTER_X, GUTTER_X + rectWidth) : posx) - strikethroughStart;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? lineWidth = strikethroughStart - (clipping ? Mathf.Clamp(posx, GUTTER_X, GUTTER_X + rectWidth) : posx);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (lineWidth > 0)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vertCount += (short)_font.DrawLine(strikethroughStart < posx ? strikethroughStart : posx, -(line.y + line.baseline), lineWidth,

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? minFontSize, 1, vertList, uvList, uv2List, colList);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? minFontSize = int.MaxValue;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? strikethroughStart = posx;

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (vertCount > 0 && _charPositions != null)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CharPosition cp = _charPositions[_charPositions.Count - 1];

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.vertCount += vertCount;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? _charPositions[_charPositions.Count - 1] = cp;

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? format = element.format;

? ? ? ? ? ? ? ? ? ? ? ? ? ? minFontSize = Math.Min(minFontSize, format.size);

? ? ? ? ? ? ? ? ? ? ? ? ? ? maxFontSize = Math.Max(maxFontSize, format.size);

? ? ? ? ? ? ? ? ? ? ? ? ? ? _font.SetFormat(format, _fontSizeScale);

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? else if (element.type == HtmlElementType.Link)

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? currentLink = (HtmlLink)element.htmlObject;

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (currentLink != null)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? element.position = Vector2.zero;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? currentLink.SetPosition(0, 0);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? linkStartX = posx;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? linkStartLine = i;

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? else if (element.type == HtmlElementType.LinkEnd)

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (currentLink != null)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? currentLink.SetArea(linkStartLine, linkStartX, i, posx);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? currentLink = null;

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? IHtmlObject htmlObj = element.htmlObject;

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (htmlObj != null)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= htmlObj.width - 2;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_charPositions != null)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CharPosition cp = new CharPosition();

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.lineIndex = (short)i;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.charIndex = _charPositions.Count;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.imgIndex = (short)(elementIndex + 1);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.offsetX = posx;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.width = (short)htmlObj.width;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? _charPositions.Add(cp);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (lineClipped || clipping && (posx < GUTTER_X || posx > GUTTER_X && posx + htmlObj.width > _contentRect.width - GUTTER_X))

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? element.status |= 1;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? element.status &= 254;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? element.position = new Vector2(posx + 1, line.y + line.baseline - htmlObj.height * IMAGE_BASELINE);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? htmlObj.SetPosition(element.position.x, element.position.y);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= letterSpacing;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx += htmlObj.width + letterSpacing + 2;

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? if (element.isEntity)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ch = '\0';

? ? ? ? ? ? ? ? ? ? ? ? elementIndex++;

? ? ? ? ? ? ? ? ? ? ? ? if (elementIndex < elementCount)

? ? ? ? ? ? ? ? ? ? ? ? ? ? element = _elements[elementIndex];

? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? element = null;

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? if (ch == '\0')

? ? ? ? ? ? ? ? ? ? ? ? continue;

#if FAIRYGUI_TMPRO

? ? ? ? ? ? ? ? ? ? if(_font.GetType() == typeof(TMPFont))

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? if (_font.GetGlyphWithFallback(ch == '\t' ? ' ' : ch, out glyphWidth, out glyphHeight, out baseline,out isFallback))

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (ch == '\t')

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? glyphWidth *= 4;

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (lineClipped || clipping && (rectWidth < 7 || posx != (indent_x - GUTTER_X)) && posx < GUTTER_X - 0.5f) //超出區(qū)域偷俭,剪裁

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= (letterSpacing + glyphWidth);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= glyphWidth;

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (lineClipped || clipping && (rectWidth < 7 || posx != (GUTTER_X + indent_x)) && posx + glyphWidth > _contentRect.width - GUTTER_X + 0.5f) //超出區(qū)域浪讳,剪裁

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx += letterSpacing + glyphWidth;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (isFallback == false)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vertCount = (short)_font.DrawGlyph(posx, -(line.y + line.baseline), vertList, uvList, uv2List, colList);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_charPositions != null)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CharPosition cp = new CharPosition();

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.lineIndex = (short)i;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.charIndex = _charPositions.Count;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.vertCount = vertCount;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.offsetX = posx;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.width = (short)glyphWidth;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? _charPositions.Add(cp);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= letterSpacing;

? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx += letterSpacing + glyphWidth;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? else //if GetGlyph failed

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_charPositions != null)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CharPosition cp = new CharPosition();

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.lineIndex = (short)i;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.charIndex = _charPositions.Count;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.offsetX = posx;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? _charPositions.Add(cp);

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= letterSpacing;

? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx += letterSpacing;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? if (_font.GetGlyph(ch == '\t' ? ' ' : ch, out glyphWidth, out glyphHeight, out baseline))

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (ch == '\t')

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? glyphWidth *= 4;

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (lineClipped || clipping && (rectWidth < 7 || posx != (indent_x - GUTTER_X)) && posx < GUTTER_X - 0.5f) //超出區(qū)域,剪裁

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= (letterSpacing + glyphWidth);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= glyphWidth;

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (lineClipped || clipping && (rectWidth < 7 || posx != (GUTTER_X + indent_x)) && posx + glyphWidth > _contentRect.width - GUTTER_X + 0.5f) //超出區(qū)域涌萤,剪裁

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx += letterSpacing + glyphWidth;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? vertCount = (short)_font.DrawGlyph(posx, -(line.y + line.baseline), vertList, uvList, uv2List, colList);

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_charPositions != null)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CharPosition cp = new CharPosition();

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.lineIndex = (short)i;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.charIndex = _charPositions.Count;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.vertCount = vertCount;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.offsetX = posx;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.width = (short)glyphWidth;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? _charPositions.Add(cp);

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= letterSpacing;

? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx += letterSpacing + glyphWidth;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? else //if GetGlyph failed

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_charPositions != null)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CharPosition cp = new CharPosition();

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.lineIndex = (short)i;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.charIndex = _charPositions.Count;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.offsetX = posx;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? _charPositions.Add(cp);

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= letterSpacing;

? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx += letterSpacing;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? }

#else

if (_font.GetGlyph(ch == '\t' ? ' ' : ch, out glyphWidth, out glyphHeight, out baseline))

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? Debug.Log("OnPopulateMesh GetGlyph:" + ch);

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (ch == '\t')

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? glyphWidth *= 4;

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (lineClipped || clipping && (rectWidth < 7 || posx != (indent_x - GUTTER_X)) && posx < GUTTER_X - 0.5f) //超出區(qū)域淹遵,剪裁

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= (letterSpacing + glyphWidth);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= glyphWidth;

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (lineClipped || clipping && (rectWidth < 7 || posx != (GUTTER_X + indent_x)) && posx + glyphWidth > _contentRect.width - GUTTER_X + 0.5f) //超出區(qū)域口猜,剪裁

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx += letterSpacing + glyphWidth;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? continue;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? vertCount = (short)_font.DrawGlyph(posx, -(line.y + line.baseline), vertList, uvList, uv2List, colList);

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_charPositions != null)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CharPosition cp = new CharPosition();

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.lineIndex = (short)i;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.charIndex = _charPositions.Count;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.vertCount = vertCount;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.offsetX = posx;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.width = (short)glyphWidth;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? _charPositions.Add(cp);

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= letterSpacing;

? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx += letterSpacing + glyphWidth;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? else //if GetGlyph failed

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_charPositions != null)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? CharPosition cp = new CharPosition();

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.lineIndex = (short)i;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.charIndex = _charPositions.Count;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cp.offsetX = posx;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? _charPositions.Add(cp);

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.RTL)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx -= letterSpacing;

? ? ? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? posx += letterSpacing;

? ? ? ? ? ? ? ? ? ? ? ? }

#endif

? ? ? ? ? ? ? ? }//text loop

? ? ? ? ? ? ? ? if (!lineClipped)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? vertCount = 0;

? ? ? ? ? ? ? ? ? ? if (format.underline)

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? float lineWidth;

? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.UNKNOW)

? ? ? ? ? ? ? ? ? ? ? ? ? ? lineWidth = (clipping ? Mathf.Clamp(posx, GUTTER_X, GUTTER_X + rectWidth) : posx) - underlineStart;

? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? lineWidth = underlineStart - (clipping ? Mathf.Clamp(posx, GUTTER_X, GUTTER_X + rectWidth) : posx);

? ? ? ? ? ? ? ? ? ? ? ? if (lineWidth > 0)

? ? ? ? ? ? ? ? ? ? ? ? ? ? vertCount += (short)_font.DrawLine(underlineStart < posx ? underlineStart : posx, -(line.y + line.baseline), lineWidth,

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? maxFontSize, 0, vertList, uvList, uv2List, colList);

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? if (format.strikethrough)

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? float lineWidth;

? ? ? ? ? ? ? ? ? ? ? ? if (_textDirection == RTLSupport.DirectionType.UNKNOW)

? ? ? ? ? ? ? ? ? ? ? ? ? ? lineWidth = (clipping ? Mathf.Clamp(posx, GUTTER_X, GUTTER_X + rectWidth) : posx) - strikethroughStart;

? ? ? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? ? ? ? ? lineWidth = strikethroughStart - (clipping ? Mathf.Clamp(posx, GUTTER_X, GUTTER_X + rectWidth) : posx);

? ? ? ? ? ? ? ? ? ? ? ? if (lineWidth > 0)

? ? ? ? ? ? ? ? ? ? ? ? ? ? vertCount += (short)_font.DrawLine(strikethroughStart < posx ? strikethroughStart : posx, -(line.y + line.baseline), lineWidth,

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? minFontSize, 1, vertList, uvList, uv2List, colList);

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? if (vertCount > 0 && _charPositions != null)

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? CharPosition cp = _charPositions[_charPositions.Count - 1];

? ? ? ? ? ? ? ? ? ? ? ? cp.vertCount += vertCount;

? ? ? ? ? ? ? ? ? ? ? ? _charPositions[_charPositions.Count - 1] = cp;

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }//line loop

? ? ? ? ? ? if (element != null && element.type == HtmlElementType.LinkEnd && currentLink != null)

? ? ? ? ? ? ? ? currentLink.SetArea(linkStartLine, linkStartX, lineCount - 1, posx);

? ? ? ? ? ? if (_charPositions != null)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? CharPosition cp = new CharPosition();

? ? ? ? ? ? ? ? cp.lineIndex = (short)(lineCount - 1);

? ? ? ? ? ? ? ? cp.charIndex = _charPositions.Count;

? ? ? ? ? ? ? ? cp.offsetX = posx;

? ? ? ? ? ? ? ? _charPositions.Add(cp);

? ? ? ? ? ? }

? ? ? ? ? ? int count = vertList.Count;

? ? ? ? ? ? if (count > 65000)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? Debug.LogWarning("Text is too large. A mesh may not have more than 65000 vertices.");

? ? ? ? ? ? ? ? vertList.RemoveRange(65000, count - 65000);

? ? ? ? ? ? ? ? colList.RemoveRange(65000, count - 65000);

? ? ? ? ? ? ? ? uvList.RemoveRange(65000, count - 65000);

? ? ? ? ? ? ? ? if (uv2List.Count > 0)

? ? ? ? ? ? ? ? ? ? uv2List.RemoveRange(65000, count - 65000);

? ? ? ? ? ? ? ? count = 65000;

? ? ? ? ? ? }

? ? ? ? ? ? if (_font.customOutline)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? bool hasShadow = _textFormat.shadowOffset.x != 0 || _textFormat.shadowOffset.y != 0;

? ? ? ? ? ? ? ? int allocCount = count;

? ? ? ? ? ? ? ? int drawDirs = 0;

? ? ? ? ? ? ? ? if (_textFormat.outline != 0)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? drawDirs = UIConfig.enhancedTextOutlineEffect ? 8 : 4;

? ? ? ? ? ? ? ? ? ? allocCount += count * drawDirs;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? if (hasShadow)

? ? ? ? ? ? ? ? ? ? allocCount += count;

? ? ? ? ? ? ? ? if (allocCount > 65000)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? Debug.LogWarning("Text is too large. Outline/shadow effect cannot be completed.");

? ? ? ? ? ? ? ? ? ? allocCount = count;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? if (allocCount != count)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? VertexBuffer vb2 = VertexBuffer.Begin();

? ? ? ? ? ? ? ? ? ? List<Vector3> vertList2 = vb2.vertices;

? ? ? ? ? ? ? ? ? ? List<Color32> colList2 = vb2.colors;

? ? ? ? ? ? ? ? ? ? Color32 col = _textFormat.outlineColor;

? ? ? ? ? ? ? ? ? ? float outline = _textFormat.outline;

? ? ? ? ? ? ? ? ? ? if (outline != 0)

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? for (int j = 0; j < drawDirs; j++)

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? for (int i = 0; i < count; i++)

? ? ? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Vector3 vert = vertList[i];

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vertList2.Add(new Vector3(vert.x + STROKE_OFFSET[j * 2] * outline, vert.y + STROKE_OFFSET[j * 2 + 1] * outline, 0));

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? colList2.Add(col);

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? vb2.uvs.AddRange(uvList);

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (uv2List.Count > 0)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? vb2.uvs2.AddRange(uv2List);

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? if (hasShadow)

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? col = _textFormat.shadowColor;

? ? ? ? ? ? ? ? ? ? ? ? Vector2 offset = _textFormat.shadowOffset;

? ? ? ? ? ? ? ? ? ? ? ? for (int i = 0; i < count; i++)

? ? ? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? ? ? Vector3 vert = vertList[i];

? ? ? ? ? ? ? ? ? ? ? ? ? ? vertList2.Add(new Vector3(vert.x + offset.x, vert.y - offset.y, 0));

? ? ? ? ? ? ? ? ? ? ? ? ? ? colList2.Add(col);

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? vb2.uvs.AddRange(uvList);

? ? ? ? ? ? ? ? ? ? ? ? if (uv2List.Count > 0)

? ? ? ? ? ? ? ? ? ? ? ? ? ? vb2.uvs2.AddRange(uv2List);

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? vb.Insert(vb2);

? ? ? ? ? ? ? ? ? ? vb2.End();

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? vb.AddTriangles();

? ? ? ? ? ? if (_richTextField != null)

? ? ? ? ? ? ? ? _richTextField.RefreshObjects();

? ? ? ? }

目前還有很多支持不完善的地方,如果運(yùn)行中動(dòng)態(tài)修改GTextField的屬性透揣,需要將對(duì)應(yīng)屬性的變動(dòng)同步到GSubTextField中济炎,目前看只能在GTextField每個(gè)屬性設(shè)置的地方添加實(shí)現(xiàn),沒(méi)找到更容易擴(kuò)展的方式辐真。開(kāi)始想把GSubTextField掛在GTextField下作為子節(jié)點(diǎn)须尚,這樣諸如位置、縮放等的動(dòng)態(tài)改變就不用額外考慮了侍咱,但實(shí)現(xiàn)中發(fā)現(xiàn)GTextField本身不是GComponen組件耐床,由于本身對(duì)FairyGUI源碼不太熟,不知道如何掛載楔脯,只能放在GTextField的同級(jí)下撩轰。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市昧廷,隨后出現(xiàn)的幾起案子钧敞,更是在濱河造成了極大的恐慌,老刑警劉巖麸粮,帶你破解...
    沈念sama閱讀 218,755評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件溉苛,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡弄诲,警方通過(guò)查閱死者的電腦和手機(jī)愚战,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,305評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門(mén),熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)齐遵,“玉大人寂玲,你說(shuō)我怎么就攤上這事」R。” “怎么了拓哟?”我有些...
    開(kāi)封第一講書(shū)人閱讀 165,138評(píng)論 0 355
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)伶授。 經(jīng)常有香客問(wèn)我断序,道長(zhǎng),這世上最難降的妖魔是什么糜烹? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,791評(píng)論 1 295
  • 正文 為了忘掉前任违诗,我火速辦了婚禮,結(jié)果婚禮上疮蹦,老公的妹妹穿的比我還像新娘诸迟。我一直安慰自己,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,794評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布阵苇。 她就那樣靜靜地躺著壁公,像睡著了一般。 火紅的嫁衣襯著肌膚如雪绅项。 梳的紋絲不亂的頭發(fā)上贮尖,一...
    開(kāi)封第一講書(shū)人閱讀 51,631評(píng)論 1 305
  • 那天,我揣著相機(jī)與錄音趁怔,去河邊找鬼湿硝。 笑死,一個(gè)胖子當(dāng)著我的面吹牛润努,可吹牛的內(nèi)容都是我干的关斜。 我是一名探鬼主播,決...
    沈念sama閱讀 40,362評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼铺浇,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼痢畜!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起鳍侣,我...
    開(kāi)封第一講書(shū)人閱讀 39,264評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤丁稀,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后倚聚,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體线衫,經(jīng)...
    沈念sama閱讀 45,724評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,900評(píng)論 3 336
  • 正文 我和宋清朗相戀三年惑折,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了授账。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,040評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡惨驶,死狀恐怖白热,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情粗卜,我是刑警寧澤屋确,帶...
    沈念sama閱讀 35,742評(píng)論 5 346
  • 正文 年R本政府宣布,位于F島的核電站续扔,受9級(jí)特大地震影響攻臀,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜测砂,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,364評(píng)論 3 330
  • 文/蒙蒙 一茵烈、第九天 我趴在偏房一處隱蔽的房頂上張望百匆。 院中可真熱鬧砌些,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,944評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至纵东,卻和暖如春粘招,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背偎球。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,060評(píng)論 1 270
  • 我被黑心中介騙來(lái)泰國(guó)打工洒扎, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人衰絮。 一個(gè)月前我還...
    沈念sama閱讀 48,247評(píng)論 3 371
  • 正文 我出身青樓袍冷,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親猫牡。 傳聞我的和親對(duì)象是個(gè)殘疾皇子胡诗,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,979評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容