Defect #19017
closedWiki PDF Export: <pre> not rendered with monospaced font
0%
Description
In redmine < pre > tags are rendered with a monospaced font. When exporting a wiki with a < pre > element, this element is not rendered with a monospaced font, loosing the intended "formatting".
Simple example:
Files
Updated by Marcel Müller over 9 years ago
I think the problem is in this line. "set_default_monospaced_font" should not be set to the default content-font (a non monospaced font). Removing this line works for me.
Updated by Toshi MARUYAMA over 9 years ago
Marcel Müller wrote:
Removing this line works for me.
But, Cyrillic is broken.
Updated by Toshi MARUYAMA over 9 years ago
I have created issue.
https://github.com/naitoh/rbpdf/issues/11
Updated by Jun NAITOH almost 9 years ago
- File rbpdf-1.19.0_ monospaced_font.pdf rbpdf-1.19.0_ monospaced_font.pdf added
- File pdf_monospaced_font_r14882.patch pdf_monospaced_font_r14882.patch added
This is font problem.
rbpdf 1.19.0 was added DejaVu SansMono font,
and Supported for font subsetting. (for reduce the size of documents using large unicode font files.)
Please use monospaced font. (see attached patch and sample pdf.)
language font list¶
config/locales | Proportional font | Monospaced font | notes |
---|---|---|---|
ar.yml | DejaVuSans | DejaVuSansMono | DejaVuSansMono Italic Arabic font has problem. |
az.yml | freesans | freemono | |
bg.yml | freesans | freemono | |
bs.yml | freesans | freemono | |
ca.yml | freesans | freemono | |
cs.yml | freesans | freemono | |
da.yml | freesans | freemono | |
de.yml | freesans | freemono | |
el.yml | freesans | freemono | |
en-GB.yml | freesans | freemono | |
en.yml | freesans | freemono | |
es-PA.yml | freesans | freemono | |
es.yml | freesans | freemono | |
et.yml | freesans | freemono | |
eu.yml | freesans | freemono | |
fa.yml | DejaVuSans | DejaVuSans | DejaVuSansMono Persian font has problem. |
fi.yml | freesans | freemono | |
fr.yml | freesans | freemono | |
gl.yml | freesans | freemono | |
he.yml | freesans | freemono | |
hr.yml | freesans | freemono | |
hu.yml | freesans | freemono | |
id.yml | freesans | freemono | |
it.yml | freesans | freemono | |
ja.yml | kozminproregular | kozminproregular | |
ko.yml | hysmyeongjostdmedium | hysmyeongjostdmedium | |
lt.yml | freesans | freemono | |
lv.yml | freesans | freemono | |
mk.yml | freesans | freemono | |
mn.yml | freesans | freemono | |
nl.yml | freesans | freemono | |
no.yml | freesans | freemono | |
pl.yml | freesans | freemono | |
pt-BR.yml | freesans | freemono | |
pt.yml | freesans | freemono | |
ro.yml | freesans | freemono | |
ru.yml | freesans | freemono | |
sk.yml | freesans | freemono | |
sl.yml | freesans | freemono | |
sq.yml | freesans | freemono | |
sr-YU.yml | freesans | freemono | |
sr.yml | freesans | freemono | |
sv.yml | freesans | freemono | |
th.yml | freeserif | freeserif | freesans and freemono Thai fonts have problem. |
tr.yml | freesans | freemono | |
uk.yml | freesans | freemono | |
vi.yml | DejaVuSans | DejaVuSans | DejaVuSansMono Vietnamese font has problem. |
zh-TW.yml | msungstdlight | msungstdlight | |
zh.yml | stsongstdlight | stsongstdlight |
Updated by Go MAEDA almost 9 years ago
- Target version set to 3.2.0
Thanks for the patch. Works fine for me.
Updated by Toshi MARUYAMA almost 9 years ago
- File Arabic.txt Arabic.txt added
I have committed from r14907 to r14911 without this change.
=== (+3,-1) lib/redmine/export/pdf.rb ===
@@ -55,6 +55,8 @@
style.delete!('B') if l(:general_pdf_fontname) == 'freeserif'
# DejaVuSans Italic Arabic and Persian font has problem.
style.delete!('I') if l(:general_pdf_fontname) == 'DejaVuSans' && current_language.to_s.casecmp("vi") != 0
+ # DejaVuSansMono Italic Arabic font has problem.
+ style.delete!('I') if l(:general_pdf_fontname) == 'DejaVuSansMono'
super(family, style, size, fontfile)
end
alias_method :set_font, :SetFont
I cannot see difference with and without this change on Arabic.txt.
Is this change needed?
Updated by Toshi MARUYAMA almost 9 years ago
Toshi MARUYAMA wrote:
I cannot see difference with and without this change on Arabic.txt.
On Arabic locale.
Updated by Jun NAITOH almost 9 years ago
I cannot see difference with and without this change on Arabic.txt.
Is this change needed?
I checked it once again. so, this change is unnecessary, Sorry.
Because Redmine 3.2(r14911) used a monospaced font in the pre tag, but a style(bold/italic) wasn't applied in the pre tag.
Updated by Toshi MARUYAMA almost 9 years ago
But monospace italic is in HTML source.
Does not PDF support "code"
and %{font-style: italic; font-family: monospace}word%
?
%{font-style: italic; font-family: monospace}italic monospace% _italic_ @monospace@ <pre> pre </pre>
Updated by Jun NAITOH almost 9 years ago
Toshi MARUYAMA wrote:
But monospace italic is in HTML source.
Does not PDF support"code"
and%{font-style: italic; font-family: monospace}word%
?
PDF don't support "code"
and %{font-family: monospace}word%
but, PDF support %{font-style: italic; font-family: DejaVuSansMono}word%
If use %{font-style: italic; font-family: DejaVuSansMono}word%
, it's no problem by following setting on Arabic locale.
style.delete!('I') if l(:general_pdf_fontname) == 'DejaVuSans' && current_language.to_s.casecmp("vi") != 0
Updated by Toshi MARUYAMA almost 9 years ago
I can see DejaVuSansMono italic has problem in Vietnamese, but I cannot see in Arabic.
Where is source?
Updated by Toshi MARUYAMA almost 9 years ago
Toshi MARUYAMA wrote:
I can see DejaVuSansMono italic has problem in Vietnamese, but I cannot see in Arabic.
This behaviour changes frequently. "family
" parameter of SetFont() sometimes comes all lower-cases.
source:trunk/lib/redmine/export/pdf.rb@14949#L53
r14950 stabilizes behaviour changes.
Updated by Toshi MARUYAMA almost 9 years ago
I try with this change on r14951, English locale is OK, but Arabic locale is NG.
I think SetFont() has stability bug.
%{font-style: italic; font-family: DejaVuSansMono}Tiếng Việt% %{font-style: italic; font-family: DejaVuSansMono}عربي%
diff --git a/config/locales/ar.yml b/config/locales/ar.yml
--- a/config/locales/ar.yml
+++ b/config/locales/ar.yml
@@ -140,8 +140,8 @@
general_csv_separator: ','
general_csv_decimal_separator: '.'
general_csv_encoding: ISO-8859-1
- general_pdf_fontname: DejaVuSans
- general_pdf_monospaced_fontname: DejaVuSansMono
+ general_pdf_fontname: freesans
+ general_pdf_monospaced_fontname: freemono
general_first_day_of_week: '7'
notice_account_updated: لقد تم تجديد الحساب بنجاح.
diff --git a/config/locales/en.yml b/config/locales/en.yml
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -141,8 +141,8 @@
general_csv_separator: ','
general_csv_decimal_separator: '.'
general_csv_encoding: ISO-8859-1
- general_pdf_fontname: freesans
- general_pdf_monospaced_fontname: freemono
+ general_pdf_fontname: DejaVuSans
+ general_pdf_monospaced_fontname: DejaVuSansMono
general_first_day_of_week: '7'
notice_account_updated: Account was successfully updated.
Updated by Jean-Philippe Lang almost 9 years ago
- Status changed from New to Closed
I'm closing this for 3.2 release. If there any problems pending, please open another issue.
Updated by Toshi MARUYAMA almost 9 years ago
r14950 is wrong.
style.delete!('I') if family.to_s.casecmp('DejaVuSans') != 0
should be
style.delete!('I') if family.to_s.casecmp('DejaVuSans') == 0