I want to display a PDF in Chinese (Korean) with thin reports

Custom font cannot be selected

Screen Shot 2020-10-26 at 11.12.08.png

Currently, the font is fixed, and it seems that you cannot specify the font you bring in. If you try to enter Chinese (even Korean) as it is, the characters will be garbled in the PDF state.

Solutions

[Korean or Chinese text cannot be displayed in PDF] 1

For Rails, create an initializer as shown here.

config/initializers/thinreports.rb


Thinreports.configure do |config|
  config.fallback_fonts <<
    Rails.root.join("app/thinreports/NotoSansCJKsc-Regular.ttf").to_s
end

The important thing here is the ttf font, and you need to use the NOTO font. (□ The display is called TOFU in English-speaking countries, and the tofu display is already tired --no more tofu --NOTO [likely] 3, and then [tofulearn.com] 2)

At first, it's "CJK", so you can display all Chinese Japanese Korean with one font file, right? I thought, but apparently not. Since the NotoCJK file downloaded properly was a Japanese version, it could not be displayed in Chinese (the part marked with □ was blank in PDF).

If you look closely, it seems that CJK also has [font version for each region] 4.

The first file I used was NotoSansCJKjp-Regular.ttf if you look closely. So, I searched for NotoSansCJKsc-Regular.ttf and guessed it, and it was perfect.

Recommended Posts

I want to display a PDF in Chinese (Korean) with thin reports
Even in Java, I want to output true with a == 1 && a == 2 && a == 3
I want to select multiple items with a custom layout in Dialog
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (PowerMockito edition)
I want to ForEach an array with a Lambda expression in Java
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (Javassist second decoction)
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (black magic edition)
I want to use a little icon in Rails
I want to monitor a specific file with WatchService
I want to define a function in Rails Console
I want to click a GoogleMap pin in RSpec
[Rails] I want to display the link destination of link_to in a separate tab
I want to find a relative path in a situation using Path
I want to make a list with kotlin and java!
I want to make a function with kotlin and java!
I want to create a Parquet file even in Ruby
I want to use FireBase to display a timeline like Twitter
I created a PDF in Java.
Implemented a strong API for "I want to display ~~ on the screen" with simple CQRS
I want to add a browsing function with ruby on rails
I want to display the images under assets/images in the production environment
[Java] I want to perform distinct with the key in the object
I want to extract between character strings with a regular expression
I want to write a nice build.gradle
I want to display background-ground-image on heroku.
I want to use DBViewer with Eclipse 2018-12! !!
I want to use @Autowired in Servlet
[Rails] I want to send data of different models in a form
I want to display images with REST Controller of Java and Spring!
I made an app to scribble with PencilKit on a PDF file
[Note] I want to get in reverse order using afterLast with JdbcTemplate
I tried to build a Firebase application development environment with Docker in 2020
I want to create a dark web SNS with Jakarta EE 8 with Java 11
I wanted to implement a slide show in a fashionable way with slick.
[Ruby] I want to display posted items in order of newest date
I want to display an error message when registering in the database
"Teacher, I want to implement a login function in Spring" ① Hello World
I want to test Action Cable with RSpec test
Read a string in a PDF file with Java
I want to send an email in Java.
I want to use arrow notation in Ruby
How to display a web page in Java
[Ruby] I want to do a method jump!
I want to use java8 forEach with index
I want to pass APP_HOME to logback in Gradle
I wanted to make (a == 1 && a == 2 && a == 3) true in Java
I want to simply write a repeating string
I want to design a structured exception handling
rsync4j --I want to touch rsync in Java.
I want to play with Firestore from Rails
Rails6 I want to make an array of values with a check box
[Xcode] I want to manage images in folders
I want to be eventually even in kotlin
SpringSecurity I was addicted to trying to log in with a hashed password (solved)
Let's create a TODO application in Java 2 I want to create a template with Spring Initializr and make a Hello world
I tried to break a block with java (1)
I want to perform aggregation processing with spring-batch
[Rails] I want to load CSS with webpacker
I want to get the value in Ruby
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (gray magic that is not so much as black magic)
Even in Java, I want to output true with a == 1 && a == 2 && a == 3 (Royal road edition that is neither magic nor anything)