Skip to content

Instantly share code, notes, and snippets.

@imandaliya
Created March 25, 2023 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imandaliya/1fdfa882a31dda0e4393afd656334119 to your computer and use it in GitHub Desktop.
Save imandaliya/1fdfa882a31dda0e4393afd656334119 to your computer and use it in GitHub Desktop.
// Remove font/typeface padding from drawn text in canvas
Paint.FontMetricsInt fontMetricsInt = new Paint.FontMetricsInt();
textPaint.getFontMetricsInt(fontMetricsInt);
canvas.translate(0, fontMetricsInt.top - fontMetricsInt.ascent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment