Project

General

Profile

Defect #10554 » tcpdf_automatic_line_break_bug_fix_r9311.patch

Jun NAITOH, 2012-04-03 12:55

View differences:

vendor/plugins/rfpdf/lib/tcpdf.rb (working copy)
1803 1803
			w = @w - @r_margin - @x;
1804 1804
		end
1805 1805

  
1806
		wmax = (w - 2 * @c_margin);
1806
		wmax = (w - 3 * @c_margin);
1807 1807

  
1808 1808
		s = txt.gsub("\r", ''); # remove carriage returns
1809 1809
		nb = s.length;
......
1862 1862
				ns += 1;
1863 1863
			end
1864 1864

  
1865
			l = GetStringWidth(s[from_j, to_index - from_j + 1]);
1865
			l = GetStringWidth(s[from_j, to_index - from_j]);
1866 1866

  
1867 1867
			if (l > wmax)
1868 1868
				#Automatic line break
......
1945 1945

  
1946 1946
		#Output text in flowing mode
1947 1947
		w = @w - @r_margin - @x;
1948
		wmax = (w - 2 * @c_margin);
1948
		wmax = (w - 3 * @c_margin);
1949 1949
    
1950 1950
		s = txt.gsub("\r", '');
1951 1951
		nb = s.length;
......
1974 1974
				if (nl == 1)
1975 1975
					@x = @l_margin;
1976 1976
					w = @w - @r_margin - @x;
1977
					wmax = (w - 2 * @c_margin);
1977
					wmax = (w - 3 * @c_margin);
1978 1978
				end
1979 1979
				nl += 1;
1980 1980
				next
......
1982 1982
			if (c == " "[0])
1983 1983
				sep= i;
1984 1984
			end
1985
			l = GetStringWidth(s[j, i - j + 1]);
1985
			l = GetStringWidth(s[j, i - j]);
1986 1986
			if (l > wmax)
1987 1987
				#Automatic line break (word wrapping)
1988 1988
				if (sep == -1)
......
1991 1991
						@x = @l_margin;
1992 1992
						@y += h;
1993 1993
						w=@w - @r_margin - @x;
1994
						wmax=(w - 2 * @c_margin);
1994
						wmax=(w - 3 * @c_margin);
1995 1995
						i += 1
1996 1996
						nl += 1
1997 1997
						next
......
2010 2010
				if (nl==1)
2011 2011
					@x = @l_margin;
2012 2012
					w = @w - @r_margin - @x;
2013
					wmax = (w - 2 * @c_margin);
2013
					wmax = (w - 3 * @c_margin);
2014 2014
				end
2015 2015
				nl += 1;
2016 2016
			else
(3-3/8)