fix layout.draw 's xbearing

This commit is contained in:
侯歌 2024-05-22 16:43:40 +08:00
parent f5055758ca
commit 5114deb694

View File

@ -616,10 +616,10 @@ void Layout::drawText(Canvas&canvas,int firstLine,int lastLine){
case ALIGN_OPPOSITE:
case ALIGN_RIGHT : x = mWidth - lw ; break;
}
measureSize(line.substr(0,1),te);
LOGV("line[%d/%d](%d,%d) [%s](%d).width=%d/%d xbearing=%f",lineNum,mLineCount,x,y,TextUtils::unicode2utf8(line).c_str(),
line.size(),lw,int(te.x_advance),te.x_bearing);
canvas.move_to(x + te.x_bearing,y);
//measureSize(line,te);
LOGV("line[%d/%d](%d,%d) [%s](%d).width=%d/%d",lineNum,mLineCount,x,y,TextUtils::unicode2utf8(line).c_str(),
line.size(),lw,int(te.x_advance));
canvas.move_to(x,y);
canvas.show_text(processBidi(line));
if(mCaretPos>=lineStart&&mCaretPos<lineEnd){
measureSize(line.substr(0,mCaretPos-lineStart),te,nullptr);