Skip to content

Commit 53ea221

Browse files
committed
Allow for larger font sprite
1 parent 07c4d68 commit 53ea221

File tree

4 files changed

+81
-7
lines changed

4 files changed

+81
-7
lines changed

graphics/opengl/OpenGLESBaseJavaLibraryM/src/main/java/org/allbinary/emulator/device/TrueTypeFontUtilBase.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,27 @@ public class TrueTypeFontUtilBase {
3838

3939
public javax.microedition.lcdui.Font currentFont = javax.microedition.lcdui.Font.getDefaultFont();
4040

41-
public final int CELLS_PER_ROW = 16; //13;
42-
public final int fontSize = 20 + 6; //currentFont.getSize() + 6;
43-
public final int baseCharWidth = fontSize + 6;
44-
public final int cellSize = fontSize + 6;// * 3 >> 1;
45-
public final int textureSize = this.getAsTextureSize(CELLS_PER_ROW * cellSize);
46-
public final int actualCellsPerRow = textureSize / cellSize;
41+
public final float widthScale;
42+
public final int scale;
43+
public final int CELLS_PER_ROW;
44+
public final int fontSize;
45+
public final int baseCharWidth;
46+
public final int cellSize;
47+
public final int textureSize;
48+
public final int actualCellsPerRow;
4749
//public final int extraCellsPerRow = actualCellsPerRow - CELLS_PER_ROW;
4850

49-
public TrueTypeFontUtilBase() {
51+
public TrueTypeFontUtilBase(final int scale, final float widthScale) {
52+
53+
this.scale = scale;
54+
this.widthScale = widthScale;
55+
this.CELLS_PER_ROW = 16; //13;
56+
this.fontSize = (20 + 6) * scale; //currentFont.getSize() + 6;
57+
this.baseCharWidth = fontSize + (6 * scale);
58+
this.cellSize = fontSize + (6 * scale);// * 3 >> 1;
59+
this.textureSize = this.getAsTextureSize(CELLS_PER_ROW * cellSize);
60+
this.actualCellsPerRow = textureSize / cellSize;
61+
5062
// LogUtil.put(LogFactory.getInstance(new StringMaker()
5163
// .append(" fontSize: ").append(fontSize)
5264
// .append(" cellSize: ").append(cellSize)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* AllBinary Open License Version 1
3+
* Copyright (c) 2011 AllBinary
4+
*
5+
* By agreeing to this license you and any business entity you represent are
6+
* legally bound to the AllBinary Open License Version 1 legal agreement.
7+
*
8+
* You may obtain the AllBinary Open License Version 1 legal agreement from
9+
* AllBinary or the root directory of AllBinary's AllBinary Platform repository.
10+
*
11+
* Created By: Travis Berthelot
12+
*
13+
*/
14+
package org.allbinary.graphics.opengles;
15+
16+
import javax.microedition.khronos.opengles.GL10;
17+
import javax.microedition.lcdui.Graphics;
18+
19+
/**
20+
*
21+
* @author User
22+
*/
23+
public class OpenGLESStrings
24+
{
25+
26+
public void set(final GL10 gl) throws Exception {
27+
throw new RuntimeException();
28+
}
29+
30+
public void initFont(final int width, final int height)
31+
{
32+
throw new RuntimeException();
33+
}
34+
35+
public void update(final GL10 gl, final int width, final int height) throws Exception
36+
{
37+
throw new RuntimeException();
38+
}
39+
40+
public void drawChar(final GL10 gl, final Graphics graphics, final char character, final int x, final int y, final int anchor)
41+
{
42+
throw new RuntimeException();
43+
}
44+
45+
public void drawChars(final GL10 gl, final Graphics graphics, final char[] data, final int offset, final int length, final int x, final int y, final int anchor)
46+
{
47+
throw new RuntimeException();
48+
}
49+
50+
public void drawString(final GL10 gl, final Graphics graphics, final String string, final int x, final int y, final int anchor)
51+
{
52+
throw new RuntimeException();
53+
}
54+
55+
public void drawSubstring(final GL10 gl, final Graphics graphics, final String string, final int offset, final int len, final int x, final int y, final int anchor)
56+
{
57+
throw new RuntimeException();
58+
}
59+
60+
}

graphics/opengl/OpenGLESNullImageJavaLibraryM/src/main/java/org/allbinary/emulator/device/TrueTypeFontUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public static TrueTypeFontUtil getInstance() {
2828
public OpenGLESImage fontImage;
2929

3030
private TrueTypeFontUtil() {
31+
super(1, 1f);
3132
}
3233

3334
public int getAsTextureSize(int textureSize)

j2me/AndroidBaseJavaLibraryM/src/main/java/org/allbinary/emulator/device/TrueTypeFontUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public static TrueTypeFontUtil getInstance() {
4747
public OpenGLESImage fontImage;
4848

4949
private TrueTypeFontUtil() {
50+
super(1, 1f);
5051
}
5152

5253
public Image getFontBitmap(final String filename, final int fontSize, final int cellSize, final BasicColor basicColor) {

0 commit comments

Comments
 (0)