TextView크기 만큼 텍스트 파일에 있는 내용을 복사해 페이지별로 저장하는 로직입니다.
그런데 이렇게 나눠서 TextView에 저장된 페이지별 데이터를 복사해서 보여주는 데
TextView영역을 벗어나 글씨가 잘리는 문제가 발생합니다.
다음은 TextView크기별 페이지를 저장하는 로직입니다만 도대체 어디가 잘못 된 걸까요???
br = new BufferedReader(new InputStreamReader(is, "utf-8"));
m_pageContent.put(pageNum, new ArrayList<String>());
while ((line = br.readLine()) != null) { //파일에서 한줄을 읽는다
Paint p = t.getPaint();
Rect rc = new Rect();
p.getTextBounds(line, 0, line.length(), rc);
int textAreaWidth = t.getWidth();
int m = rc.width() / textAreaWidth;
if ( m == 0 ){
heightLineCount++;
}else{
heightLineCount += m;
if ( rc.width() % textAreaWidth > 0 )
heightLineCount++;
}
//라인수가 textViewHeight를 넘어갔는지 체크 한다
line = line + "\n";
float cap = Math.round(p.descent() - p.ascent());
if ( heightLineCount * cap < t.getHeight() ){
//페이지
m_pageContent.get(pageNum).add(line);
}else{
Log.d("superdroid", "mmmo");
break;
}