PDF: import tcpdf.rb patch (#8312).
Contributed Jun NAITOH. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5717 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
48a6fb45a7
commit
ba2fb5340e
|
@ -669,10 +669,11 @@ class TCPDF
|
||||||
# @since 1.4
|
# @since 1.4
|
||||||
# @see PageNo(), Footer()
|
# @see PageNo(), Footer()
|
||||||
#
|
#
|
||||||
def alias_nb_pages(alias_nb ='{nb}')
|
def AliasNbPages(alias_nb ='{nb}')
|
||||||
#Define an alias for total number of pages
|
#Define an alias for total number of pages
|
||||||
@alias_nb_pages = escapetext(alias_nb)
|
@alias_nb_pages = escapetext(alias_nb)
|
||||||
end
|
end
|
||||||
|
alias_method :alias_nb_pages, :AliasNbPages
|
||||||
|
|
||||||
#
|
#
|
||||||
# This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid.
|
# This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid.
|
||||||
|
@ -1154,10 +1155,10 @@ class TCPDF
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
s.each_byte do |c|
|
s.each_byte do |c|
|
||||||
if cw[c]
|
if cw[c.chr]
|
||||||
w += cw[c];
|
w += cw[c.chr];
|
||||||
elsif cw[?c]
|
elsif cw[?c.chr]
|
||||||
w += cw[?c]
|
w += cw[?c.chr]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1433,9 +1434,7 @@ class TCPDF
|
||||||
end
|
end
|
||||||
|
|
||||||
# try to add font (if not already added)
|
# try to add font (if not already added)
|
||||||
if (@is_unicode)
|
AddFont(family, style);
|
||||||
AddFont(family, style);
|
|
||||||
end
|
|
||||||
|
|
||||||
#Test if font is already selected
|
#Test if font is already selected
|
||||||
if ((@font_family == family) and (@font_style == style) and (@font_size_pt == size))
|
if ((@font_family == family) and (@font_style == style) and (@font_size_pt == size))
|
||||||
|
@ -2293,7 +2292,7 @@ class TCPDF
|
||||||
def putpages()
|
def putpages()
|
||||||
nb = @page;
|
nb = @page;
|
||||||
if (@alias_nb_pages)
|
if (@alias_nb_pages)
|
||||||
nbstr = UTF8ToUTF16BE(nb, false);
|
nbstr = UTF8ToUTF16BE(nb.to_s, false);
|
||||||
#Replace number of pages
|
#Replace number of pages
|
||||||
1.upto(nb) do |n|
|
1.upto(nb) do |n|
|
||||||
@pages[n].gsub!(@alias_nb_pages, nbstr)
|
@pages[n].gsub!(@alias_nb_pages, nbstr)
|
||||||
|
|
Loading…
Reference in New Issue