@@ -352,7 +352,7 @@ public Paint(int flags) {
352352 // setHinting(DisplayMetrics.DENSITY_DEVICE >= DisplayMetrics.DENSITY_TV
353353 // ? HINTING_OFF : HINTING_ON);
354354 mCompatScaling = mInvCompatScaling = 1 ;
355- mLocale = Locale .getDefault ();
355+ setTextLocale ( Locale .getDefault () );
356356 }
357357
358358 /**
@@ -365,7 +365,6 @@ public Paint(int flags) {
365365 public Paint (Paint paint ) {
366366 mNativePaint = native_initWithPaint (paint .mNativePaint );
367367 setClassVariablesFrom (paint );
368- mLocale = paint .mLocale ;
369368 }
370369
371370 /** Restores the paint to its default settings. */
@@ -379,7 +378,7 @@ public void reset() {
379378 mHasCompatScaling = false ;
380379 mCompatScaling = mInvCompatScaling = 1 ;
381380 mBidiFlags = BIDI_DEFAULT_LTR ;
382- mLocale = Locale .getDefault ();
381+ setTextLocale ( Locale .getDefault () );
383382 }
384383
385384 /**
@@ -1064,12 +1063,26 @@ public Locale getTextLocale() {
10641063 /**
10651064 * Set the text locale.
10661065 *
1067- * This controls how the text will be drawn. Providing the ROOT Locale (default case)
1068- * means that the text will be drawn with the font corresponding to its script.
1066+ * The text locale affects how the text is drawn for some languages.
1067+ *
1068+ * For example, if the locale is {@link Locale#CHINESE} or {@link Locale#CHINA},
1069+ * then the text renderer will prefer to draw text using a Chinese font. Likewise,
1070+ * if the locale is {@link Locale#JAPANESE} or {@link Locale#JAPAN}, then the text
1071+ * renderer will prefer to draw text using a Japanese font.
1072+ *
1073+ * This distinction is important because Chinese and Japanese text both use many
1074+ * of the same Unicode code points but their appearance is subtly different for
1075+ * each language.
1076+ *
1077+ * By default, the text locale is initialized to the system locale (as returned
1078+ * by {@link Locale#getDefault}). This assumes that the text to be rendered will
1079+ * most likely be in the user's preferred language.
10691080 *
1070- * Using the CHINESE or CHINA Locale means that the text will be drawn with a Chinese font.
1071- * Using the JAPANESE or JAPAN Locale means that the text will be drawn with a Japanese font.
1072- * Using the KOREAN or KOREA Locale means that the text will be drawn with a Korean font.
1081+ * If the actual language of the text is known, then it can be provided to the
1082+ * text renderer using this method. The text renderer may attempt to guess the
1083+ * language script based on the contents of the text to be drawn independent of
1084+ * the text locale here. Specifying the text locale just helps it do a better
1085+ * job in certain ambiguous cases
10731086 *
10741087 * @param locale the paint's locale value for drawing text, must not be null.
10751088 */
0 commit comments