only use a single wide character in coverbitmap

This commit is contained in:
Adrian Ulrich 2016-09-17 09:32:16 +02:00
parent c8e4973d0f
commit 02e961581c

View File

@ -400,8 +400,14 @@ public final class CoverBitmap {
final float textSize = width * 0.4f;
title = title.replaceFirst("(?i)^The ", ""); // 'The\s' shall not be a part of the string we are drawing.
title = title.replaceAll("[ <>_-]", ""); // Remove clutter, so eg. J-Rock becomes JR
String subText = (title+" ").substring(0,2);
// Use only the first char if it is 'wide'
if(Character.UnicodeBlock.of(subText.charAt(0)) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS) {
subText = subText.substring(0,1);
}
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();