Skip to content

Commit

Permalink
feat: AA: Add Roboto font
Browse files Browse the repository at this point in the history
  • Loading branch information
tzebrowski committed Sep 23, 2023
1 parent 86e1b7d commit 41534e7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,16 @@ internal class DrawingManager(context: Context, private val settings: ScreenSet
private val statusPaint = Paint()
private val valuePaint = Paint()
private val backgroundPaint = Paint()
private val titlePaint = Paint()

var canvas: Canvas? = null

private val background: Bitmap =
BitmapFactory.decodeResource(context.resources, R.drawable.background)

private val regularFont: Typeface = Typeface.createFromAsset(context.assets, "fonts/Roboto-Regular.ttf")
private val italicFont = Typeface.createFromAsset(context.assets, "fonts/Roboto-LightItalic.ttf")

private val statusLabel: String
private val profileLabel: String
private val fpsLabel: String
Expand All @@ -56,10 +60,18 @@ internal class DrawingManager(context: Context, private val settings: ScreenSet
valuePaint.color = Color.WHITE
valuePaint.isAntiAlias = true
valuePaint.style = Paint.Style.FILL
valuePaint.typeface = regularFont


titlePaint.isAntiAlias = true
titlePaint.style = Paint.Style.FILL
titlePaint.typeface = italicFont
titlePaint.color = Color.LTGRAY

statusPaint.color = Color.WHITE
statusPaint.isAntiAlias = true
statusPaint.style = Paint.Style.FILL
statusPaint.typeface = regularFont

paint.color = Color.BLACK
paint.isAntiAlias = true
Expand Down Expand Up @@ -272,17 +284,15 @@ internal class DrawingManager(context: Context, private val settings: ScreenSet
textSize: Float
) {

paint.typeface = Typeface.create(Typeface.DEFAULT, Typeface.ITALIC)
paint.color = Color.LTGRAY
paint.textSize = textSize
titlePaint.textSize = textSize
if (settings.isBreakLabelTextEnabled()) {
val text = metric.source.command.pid.description.split("\n")
if (text.size == 1) {
canvas?.drawText(
text[0],
left,
top,
paint
titlePaint
)
} else {
paint.textSize = textSize * 0.8f
Expand All @@ -292,9 +302,9 @@ internal class DrawingManager(context: Context, private val settings: ScreenSet
it,
left,
vPos,
paint
titlePaint
)
vPos += paint.textSize
vPos += titlePaint.textSize
}
}
} else {
Expand All @@ -303,7 +313,7 @@ internal class DrawingManager(context: Context, private val settings: ScreenSet
text,
left,
top,
paint
titlePaint
)

}
Expand Down Expand Up @@ -335,7 +345,6 @@ internal class DrawingManager(context: Context, private val settings: ScreenSet
textSize: Float,
paint1: Paint
): Float {
paint1.typeface = Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)
paint1.color = color
paint1.textSize = textSize
canvas?.drawText(text, left, top, paint1)
Expand Down

0 comments on commit 41534e7

Please sign in to comment.