spacepaste

  1.  
  2. // OnPopulateMesh modified
  3. if (this.FontToUse == null || this.m_DisableFontTextureChangedCallback) {
  4. return;
  5. }
  6. this.m_DisableFontTextureChangedCallback = true;
  7. Rect rect = base.rectTransform.rect;
  8. base.cachedTextGenerator.Populate(this.PostprocessText(), this.GetGenerationSettings(rect.size));
  9. base.cachedTextGenerator.GetVertices(this.m_UIVertices);
  10. // this part actually lives in another method but has been inlined for the paste
  11. // these variables don't appear to be used further down the method body
  12. // but if they are and i overlooked it, it could be a source of error
  13. UIVertex vertex = this.m_UIVertices[0];
  14. Vector2 refPoint = new Vector2(vertex.position.x, vertex.position.y) * this.pixelsPerUnit;
  15. Vector2 pixelAdjustPoint = this.PixelAdjustPoint(refPoint);
  16. pixelAdjustPoint.x = Mathf.FloorToInt(pixelAdjustPoint.x);
  17. pixelAdjustPoint.y = Mathf.FloorToInt(pixelAdjustPoint.y);
  18. Vector2 roundingOffset = pixelAdjustPoint - refPoint;
  19. float scale = 1f / this.pixelsPerUnit;
  20. for(int i = 0; i < this.m_UIVertices.Count; i++) {
  21. vertex = this.m_UIVertices[i];
  22. vertex.position *= scale;
  23. vertex.position.x = vertex.position.x + roundingOffset.x;
  24. vertex.position.y = vertex.position.y + roundingOffset.y;
  25. this.m_UIVertices[i] = vertex;
  26. }
  27. // end inline
  28. if (this.m_UIVertices.Count > 0) {
  29. this.m_UIVertices.RemoveRange(this.m_UIVertices.Count - 4, 4);
  30. }
  31.