Skip to content

Commit

Permalink
Auto merge of #176 - taishi132:master, r=jdm
Browse files Browse the repository at this point in the history
Changed examples/render-glyph to handle multi-byte characters

Before this change, a garbage glyph would be rendered if a multi-byte character was used as input on the command line. Now it will render properly if the selected font supports the corresponding glyph.

Ex:
`ArialMT ä` works.
`ArialMT 心` doesn't work because Arial doesn't have the glyph.
`SimSun 心` works.
  • Loading branch information
bors-servo authored Dec 25, 2020
2 parents f0cb880 + d1cf3c2 commit 1bfbc93
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/render-glyph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fn main() {
let matches = get_args();

let postscript_name = matches.value_of("POSTSCRIPT-NAME").unwrap();
let character = matches.value_of("GLYPH").unwrap().as_bytes()[0] as char;
let character = matches.value_of("GLYPH").unwrap().chars().next().unwrap();
let size: f32 = matches.value_of("SIZE").unwrap().parse().unwrap();

let (canvas_format, rasterization_options) = if matches.is_present("bilevel") {
Expand Down

0 comments on commit 1bfbc93

Please sign in to comment.