-
- // OnPopulateMesh modified
- if (this.FontToUse == null || this.m_DisableFontTextureChangedCallback) {
- return;
- }
- this.m_DisableFontTextureChangedCallback = true;
- Rect rect = base.rectTransform.rect;
- base.cachedTextGenerator.Populate(this.PostprocessText(), this.GetGenerationSettings(rect.size));
- base.cachedTextGenerator.GetVertices(this.m_UIVertices);
-
- // this part actually lives in another method but has been inlined for the paste
- // these variables don't appear to be used further down the method body
- // but if they are and i overlooked it, it could be a source of error
- UIVertex vertex = this.m_UIVertices[0];
- Vector2 refPoint = new Vector2(vertex.position.x, vertex.position.y) * this.pixelsPerUnit;
- Vector2 pixelAdjustPoint = this.PixelAdjustPoint(refPoint);
- pixelAdjustPoint.x = Mathf.FloorToInt(pixelAdjustPoint.x);
- pixelAdjustPoint.y = Mathf.FloorToInt(pixelAdjustPoint.y);
- Vector2 roundingOffset = pixelAdjustPoint - refPoint;
- float scale = 1f / this.pixelsPerUnit;
- for(int i = 0; i < this.m_UIVertices.Count; i++) {
- vertex = this.m_UIVertices[i];
- vertex.position *= scale;
- vertex.position.x = vertex.position.x + roundingOffset.x;
- vertex.position.y = vertex.position.y + roundingOffset.y;
- this.m_UIVertices[i] = vertex;
- }
- // end inline
-
- if (this.m_UIVertices.Count > 0) {
- this.m_UIVertices.RemoveRange(this.m_UIVertices.Count - 4, 4);
- }
-