mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-07-28 14:52:53 +00:00
fix font texture resizing and node insertion of fullwidth char
This commit is contained in:
parent
1739f2f936
commit
cd75c1f1cd
@ -127,7 +127,7 @@ public class DynamicFontTexture extends AbstractTexture {
|
|||||||
}
|
}
|
||||||
bind();
|
bind();
|
||||||
sheetGlyphInfo.upload(assignedNode.x, assignedNode.y);
|
sheetGlyphInfo.upload(assignedNode.x, assignedNode.y);
|
||||||
regGlyphWrapper[0] = new RegisteredGlyph(assignedNode.x, assignedNode.y, assignedNode.x + assignedNode.width, assignedNode.y + assignedNode.height);
|
regGlyphWrapper[0] = new RegisteredGlyph(assignedNode.x, assignedNode.y, assignedNode.x + sheetGlyphInfo.getPixelWidth(), assignedNode.y + sheetGlyphInfo.getPixelHeight());
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
return regGlyphWrapper[0];
|
return regGlyphWrapper[0];
|
||||||
@ -144,7 +144,7 @@ public class DynamicFontTexture extends AbstractTexture {
|
|||||||
TextureUtil.prepareImage(NativeImage.InternalGlFormat.RGBA, newId, desiredSize, desiredSize);
|
TextureUtil.prepareImage(NativeImage.InternalGlFormat.RGBA, newId, desiredSize, desiredSize);
|
||||||
ARBCopyImage.glCopyImageSubData(id, GL11.GL_TEXTURE_2D, 0, 0, 0, 0,
|
ARBCopyImage.glCopyImageSubData(id, GL11.GL_TEXTURE_2D, 0, 0, 0, 0,
|
||||||
newId, GL11.GL_TEXTURE_2D, 0, 0, 0, 0,
|
newId, GL11.GL_TEXTURE_2D, 0, 0, 0, 0,
|
||||||
currentSize, currentSize, 0);
|
currentSize, currentSize, 1);
|
||||||
TextureUtil.releaseTextureId(id);
|
TextureUtil.releaseTextureId(id);
|
||||||
this.id = newId;
|
this.id = newId;
|
||||||
}
|
}
|
||||||
@ -218,11 +218,15 @@ public class DynamicFontTexture extends AbstractTexture {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
int halfSize = width / 2;
|
int halfSize = width / 2;
|
||||||
|
if(glyphW > halfSize && glyphH > halfSize){
|
||||||
|
occupied = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
if(glyphW <= halfSize && glyphH > halfSize){
|
if(glyphW <= halfSize && glyphH > halfSize){
|
||||||
this.topLeft = new TextureSlotNode(this.x, this.y, halfSize, this.height);
|
this.topLeft = new TextureSlotNode(this.x, this.y, halfSize, this.height);
|
||||||
this.topRight = new TextureSlotNode(this.x + halfSize, this.y, halfSize, this.height);
|
this.topRight = new TextureSlotNode(this.x + halfSize, this.y, halfSize, this.height);
|
||||||
}
|
}
|
||||||
else if(glyphW > halfSize && glyphH <= halfSize){
|
else if(glyphW > halfSize){
|
||||||
this.topLeft = new TextureSlotNode(this.x, this.y, this.width, halfSize);
|
this.topLeft = new TextureSlotNode(this.x, this.y, this.width, halfSize);
|
||||||
this.bottomLeft = new TextureSlotNode(this.x, this.y + halfSize, this.width, halfSize);
|
this.bottomLeft = new TextureSlotNode(this.x, this.y + halfSize, this.width, halfSize);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user