Fix text block display issues
This commit is contained in:
parent
b7cbf4486f
commit
1187d7896c
2 changed files with 2 additions and 2 deletions
|
@ -167,7 +167,7 @@ namespace Pixi.Images
|
||||||
position.x += 1f;
|
position.x += 1f;
|
||||||
position.y += (float)blockSize;
|
position.y += (float)blockSize;
|
||||||
string text = PixelUtility.TextureToString(img);
|
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;
|
textBlock.Text = text;
|
||||||
byte[] textHash;
|
byte[] textHash;
|
||||||
using (HashAlgorithm hasher = SHA256.Create())
|
using (HashAlgorithm hasher = SHA256.Create())
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace Pixi.Images
|
||||||
|
|
||||||
public static string TextureToString(Texture2D img)
|
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 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++)
|
for (int x = 0; x < img.width; x++)
|
||||||
|
|
Loading…
Reference in a new issue