Defect #19017
Wiki PDF Export: <pre> not rendered with monospaced font
Status: | Closed | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | PDF export | |||
Target version: | 3.2.0 | |||
Resolution: | Affected version: | 2.6.1 |
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:
Associated revisions
pdf: use "family" parameter instead of l(:general_pdf_fontname) at SetFont method (#19017)
Contributed by Jun NAITOH.
pdf: upgrade rbpdf to 1.19.0 (#19017)
Contributed by Jun NAITOH.
pdf: add general_pdf_monospaced_fontname to locales (#19017)
Contributed by Jun NAITOH.
pdf: use l(:general_pdf_monospaced_fontname) (#19017)
Contributed by Jun NAITOH.
pdf: use "family" parameter instead of l(:general_pdf_fontname) at SetFont method (#19017)
Contributed by Jun NAITOH.
pdf: use "family" parameter instead of l(:general_pdf_fontname) at SetFont method (#19017)
Contributed by Jun NAITOH.
pdf: remove italic from DejaVuSansMono (#19017)
DejaVuSansMono Italic Arabic font has problem.
Contributed by Jun NAITOH.
pdf: use all lower cases for DejaVuSansMono (#19017)
History
#1
Updated by Marcel Müller almost 6 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.
#2
Updated by Toshi MARUYAMA almost 6 years ago
- File fonts.png added
Marcel Müller wrote:
Removing this line works for me.
But, Cyrillic is broken.
#3
Updated by Toshi MARUYAMA almost 6 years ago
I have created issue.
https://github.com/naitoh/rbpdf/issues/11
#4
Updated by Jun NAITOH about 5 years ago
- File rbpdf-1.19.0_ monospaced_font.pdf added
- File 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 |
#5
Updated by Go MAEDA about 5 years ago
- Target version set to 3.2.0
Thanks for the patch. Works fine for me.
#6
Updated by Toshi MARUYAMA about 5 years ago
- Assignee set to Toshi MARUYAMA
#7
Updated by Toshi MARUYAMA about 5 years ago
- File 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?
#8
Updated by Toshi MARUYAMA about 5 years ago
Toshi MARUYAMA wrote:
I cannot see difference with and without this change on Arabic.txt.
On Arabic locale.
#9
Updated by Jun NAITOH about 5 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.
#10
Updated by Toshi MARUYAMA about 5 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>
#11
Updated by Jun NAITOH about 5 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
#12
Updated by Toshi MARUYAMA about 5 years ago
I can see DejaVuSansMono italic has problem in Vietnamese, but I cannot see in Arabic.
Where is source?
#13
Updated by Toshi MARUYAMA about 5 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.
#14
Updated by Toshi MARUYAMA about 5 years ago
#15
Updated by Toshi MARUYAMA about 5 years ago
- File ar-en.png added
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.
#16
Updated by Jean-Philippe Lang about 5 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.
#17
Updated by Toshi MARUYAMA about 5 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
#18
Updated by Toshi MARUYAMA about 5 years ago
#19
Updated by Toshi MARUYAMA about 5 years ago
#20
Updated by Jean-Philippe Lang about 5 years ago
Thanks.