Browse Source

Fix text block display issues

tags/v0.3.0
NGnius (Graham) 4 years ago
parent
commit
1187d7896c
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      Pixi/Images/ImageCommands.cs
  2. +1
    -1
      Pixi/Images/PixelUtility.cs

+ 1
- 1
Pixi/Images/ImageCommands.cs View File

@@ -167,7 +167,7 @@ namespace Pixi.Images
position.x += 1f;
position.y += (float)blockSize;
string text = PixelUtility.TextureToString(img);
TextBlock textBlock = TextBlock.PlaceNew(position, scale: new float3(Mathf.Ceil(img.width / 16), Mathf.Ceil(img.height / 16), 1));
TextBlock textBlock = TextBlock.PlaceNew(position, scale: new float3(Mathf.Ceil(img.width / 16), 1, Mathf.Ceil(img.height / 16)));
textBlock.Text = text;
byte[] textHash;
using (HashAlgorithm hasher = SHA256.Create())


+ 1
- 1
Pixi/Images/PixelUtility.cs View File

@@ -149,7 +149,7 @@ namespace Pixi.Images

public static string TextureToString(Texture2D img)
{
StringBuilder imgString = new StringBuilder("<cspace=-0.1em><line-height=42%>");
StringBuilder imgString = new StringBuilder("<cspace=-0.13em><line-height=40%>");
for (int y = img.height-1; y >= 0 ; y--) // text origin is top right, but img origin is bottom right
{
for (int x = 0; x < img.width; x++)