siwangqishiq / ImageEditor-Android

AndroidImageEdit 安卓设备上图形编辑开源控件,支持磨皮美白 自定义贴图 图片滤镜 图片旋转 图片剪裁 文字贴图 撤销 回退 等操作
2.18k stars 567 forks source link

Border box of Text not showing properly in CENTER or RIGHT text alignment #93

Open mianaliasjad opened 4 years ago

mianaliasjad commented 4 years ago

Hi, If we set the text alignment to center in TextStickerView then the border square box of text becomes broken. You just have to change text alignment on this line and run the app then add text.

Screenshot_2020-04-04-12-20-32

meysam-mo commented 1 year ago

i solved this issue with change below code in TextStickerView.java Line: 252

for (int i = 0; i < mTextContents.size(); i++) {
   int alignX = x;
   if (mPaint.getTextAlign() == Paint.Align.CENTER)
      alignX = (int) ((rect.left + rect.right)/2);

   else if (mPaint.getTextAlign() == Paint.Align.RIGHT)
      alignX = (int) rect.right;

   else if (mPaint.getTextAlign() == Paint.Align.LEFT)
      alignX = (int) rect.left;

   canvas.drawText(mTextContents.get(i), alignX, draw_text_y, mPaint);
   draw_text_y += text_height;
}