android - It seems that Paint.measureText() function is not correct for all languages -


i have implemented ellipsize text function works correct english strings. when applied languages deutch strings not truncated properly. after debuugging came conclusion measuretext not workning properly. here code:

for (int = 0; < valuecount; i++) {          textwidth = mselectorwheelpaint.measuretext(moriginalvalues[i]);         if (textwidth > maxstringwidth) {             float diff = textwidth - maxstringwidth;             int numletterstosubstract = math.round(diff / oneletterwidth);             int length = moriginalvalues[i].length();             mdisplayedvalues[i] = moriginalvalues[i].substring(0,                     (length - 1) - (numletterstosubstract + 3));             if (!customlocaleutil.isrtl()) {                 mdisplayedvalues[i] = string.format("%s...",                         mdisplayedvalues[i]);             } else {                 mdisplayedvalues[i] = string.format("...%s",                         mdisplayedvalues[i]);             }         } else {             mdisplayedvalues[i] = moriginalvalues[i];         } 


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -