Prawn: text()λŠ” μ„ ν–‰ 곡백을 μ–΅μ œν•©λ‹ˆλ‹€.

에 λ§Œλ“  2010λ…„ 02μ›” 11일  Β·  6μ½”λ©˜νŠΈ  Β·  좜처: prawnpdf/prawn

 Prawn::Document.generate('x.pdf") do
 ν…μŠ€νŠΈ "x"
 ν…μŠ€νŠΈ "x"
 끝

λŒ€μ‘°:

 Prawn::Document.generate('x.pdf") do
 ν…μŠ€νŠΈ "| x"
 ν…μŠ€νŠΈ "| x"
 끝

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

@thbar 쀄 λ°”κΏˆμ΄ μ—¬λŸ¬ 개인 경우 μ˜ˆμ œκ°€ μ€‘λ‹¨λ©λ‹ˆλ‹€. λŒ€μ‹  λ‹€μŒμ„ μ‚¬μš©ν•˜μ‹­μ‹œμ˜€.

content = content.gsub(/^([^\S\r\n]+)/m) { |m| "\xC2\xA0" * m.size }

http://stackoverflow.com/a/17752989/165673 μ—μ„œ

λͺ¨λ“  6 λŒ“κΈ€

버그가 μ•„λ‹™λ‹ˆλ‹€. Daniel의 μ˜λ„μ  행동 λ³€ν™”. 보닀:
http://groups.google.com/group/prawn-ruby/browse_thread/thread/836c1349ec76c720

μ’‹μ•„, ν•˜μ§€λ§Œ 이 λ“€μ—¬μ“°κΈ°λ₯Ό μ–΄λ–»κ²Œ λ Œλ”λ§ν•  수 μžˆμŠ΅λ‹ˆκΉŒ?

   Prawn::Document.generate('x.pdf") do 
   text "              xxxxxx
               xxxxxx      
                   xxxxxxxxxxxxx"
   end

:indent_paragraphs 속성은 이것을 도와쀄 수 μ—†μŠ΅λ‹ˆλ‹€.

쀄 λ°”κΏˆν•˜μ§€ μ•ŠλŠ” 곡백 μ‚¬μš©: http://en.wikipedia.org/wiki/Non-breaking_space

λ‹€μŒμ€ 쀄 λ°”κΏˆν•˜μ§€ μ•ŠλŠ” 곡백을 μ‚¬μš©ν•˜μ—¬ 이 μž‘μ—…μ„ μˆ˜ν–‰ν•˜λŠ” λ°©λ²•μ˜ μ˜ˆμž…λ‹ˆλ‹€(일뢀 μ½”λ“œλ₯Ό ν‘œμ‹œν•˜λ €λ©΄ μ—¬κΈ°).

content = "def function(param)\n  puts 'this'\nend"
content = content.gsub(/^(\s+)/m) { |m| "\xC2\xA0" * m.size }
font "courier" do
  text content
end

@thbar 쀄 λ°”κΏˆμ΄ μ—¬λŸ¬ 개인 경우 μ˜ˆμ œκ°€ μ€‘λ‹¨λ©λ‹ˆλ‹€. λŒ€μ‹  λ‹€μŒμ„ μ‚¬μš©ν•˜μ‹­μ‹œμ˜€.

content = content.gsub(/^([^\S\r\n]+)/m) { |m| "\xC2\xA0" * m.size }

http://stackoverflow.com/a/17752989/165673 μ—μ„œ

λ‚΄μš© = content.gsub(/^([^\S\r\n]+)/m) { |m| "\xC2\xA0" * m.size }
이 일을 ν•œ ν›„ λ‚˜λŠ”

PDF's built-in fonts have very limited support for internationalized text.
If you need full UTF-8 support, consider using a TTF font instead.

To disable this warning, add the following line to your code:
Prawn::Font::AFM.hide_m17n_warning = true

그런 λ‹€μŒ 글꼴을 λ‹€μš΄λ‘œλ“œν•˜λ©΄ μž‘λ™ν•©λ‹ˆλ‹€.
κ°μ‚¬ν•©λ‹ˆλ‹€.

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰