mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
We are already shipping Roboto-Condensed.ttf, let's use it
This commit is contained in:
parent
e4d2c95968
commit
751c61bd69
2 changed files with 14 additions and 0 deletions
|
@ -406,6 +406,7 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback {
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
TextRenderer.init(this);
|
||||
shuttingDown = false;
|
||||
registerCallbacks();
|
||||
|
||||
|
|
|
@ -1,17 +1,30 @@
|
|||
package org.ppsspp.ppsspp;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.util.Log;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class TextRenderer {
|
||||
private static Paint p;
|
||||
private static Paint bg;
|
||||
private static Typeface robotoCondensed;
|
||||
private static final String TAG = "TextRenderer";
|
||||
static {
|
||||
p = new Paint(Paint.SUBPIXEL_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG);
|
||||
p.setColor(Color.WHITE);
|
||||
bg = new Paint();
|
||||
bg.setColor(Color.BLACK);
|
||||
}
|
||||
public static void init(Context ctx) {
|
||||
robotoCondensed = Typeface.createFromAsset(ctx.getAssets(), "Roboto-Condensed.ttf");
|
||||
if (robotoCondensed != null) {
|
||||
Log.i(TAG, "Successfully loaded Roboto Condensed");
|
||||
p.setTypeface(robotoCondensed);
|
||||
} else {
|
||||
Log.e(TAG, "Failed to load Roboto Condensed");
|
||||
}
|
||||
}
|
||||
private static Point measure(String string, double textSize) {
|
||||
Rect bound = new Rect();
|
||||
p.setTextSize((float)textSize);
|
||||
|
|
Loading…
Add table
Reference in a new issue