Skip to content

Instantly share code, notes, and snippets.

@wypk
Created May 5, 2018 00:21
Show Gist options
  • Save wypk/32b65eff26f1fd47bef09c97b463e135 to your computer and use it in GitHub Desktop.
Save wypk/32b65eff26f1fd47bef09c97b463e135 to your computer and use it in GitHub Desktop.
public class FontChecker {
private static FontChecker fontChecker;
private FontChecker() {
}
public static FontChecker getInstance() {
if (fontChecker == null) {
fontChecker = new FontChecker();
}
return fontChecker;
}
public final boolean isUnicode(Context mContext) {
TextView textView = new TextView(mContext, null);
textView.setLayoutParams(new ViewGroup.LayoutParams(-2, -2));
textView.setText("က");
textView.measure(-2, -2);
int length1 = textView.getMeasuredWidth();
textView.setText("က္က");
textView.measure(-2, -2);
int length2 = textView.getMeasuredWidth();
return length1 == length2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment