String s = “?text=Hello, World!\n” +
“\tfont_style=bold\n” +
“\tfont_size=24\n” +
“\n” +
“#你今天你今天怎么样子?\n” +
“\t() Pretty good, thanks! () I won’t respond until I see my lawyer.\n” +
“\t()很好你很好很好挖到! () I won’t respond until I see my lawyer.\n” +
“#How are you doing today?\n” +
“\t() Pretty good, thanks! () I won’t respond until I see my lawyer.\n”;
Files.write(Paths.get(“测试-utf8.txt”),s.getBytes(StandardCharsets.UTF_8));
OmrEngine engine = new OmrEngine();
GlobalPageSettings pageSettings = new GlobalPageSettings();
I have investigated provided template. There appears to be improvements that can be made on this template. Please see examples of C# and Java code, with the results in attachment: OMRJAVA-108.zip (170.5 KB)
Please note changes made in template:
Removed spacing in “?text=” element prefix.
Added “\r” before “\n” as per my Environment new line (Windows).
Changed quotation symbols from U+201C Left Double Quotation mark Unicode character to a regular U+0022.
public static void main(String[] args) throws IOException {
String s = "?text=Hello, world! \r\n" +
"\tfont_style=bold\r\n" +
"\tfont_size=24\r\n" +
"\r\n" +
"#你今天你今天怎么样子? \r\n" +
"\t()Pretty good, thanks! () I won't respond until I see my lawyer.\r\n" +
"\t()很好你很好很好挖到! () I won't respond until I see my lawyer.\r\n" +
"#How are you doing today? \r\n" +
"\t()Pretty good, thanks! ()I won’t respond until I see my lawyer.\r\n";
Files.write(Paths.get("d:\\测试 - utf8.txt"), s.getBytes(StandardCharsets.UTF_8));
OmrEngine engine = new OmrEngine();
GlobalPageSettings pageSettings = new GlobalPageSettings();
pageSettings.FontFamily = "SimSun";
pageSettings.FontSize = 16;
GenerationResult res = engine.generateTemplate("d:\\测试 - utf8.txt", pageSettings);
res.save(String.valueOf(Paths.get("d:\\")), "template-java");
}
public static void main(String[] args) throws Exception {
test();
}
public static void test() throws Exception {
String s = "?text=Hello, world! \r\n" +
"\tfont_style=bold\r\n" +
"\tfont_size=24\r\n" +
"\r\n" +
"#你今天你今天怎么样子? \r\n" +
"\t()Pretty good, thanks! () I won't respond until I see my lawyer.\r\n" +
"\t()很好你很好很好挖到! () I won't respond until I see my lawyer.\r\n" +
"#How are you doing today? \r\n" +
"\t()Pretty good, thanks! ()I won’t respond until I see my lawyer.\r\n";
Files.write(Paths.get("d:\\测试 - utf8.txt"), s.getBytes(StandardCharsets.UTF_8));
OmrEngine engine = new OmrEngine();
GlobalPageSettings pageSettings = new GlobalPageSettings();
pageSettings.FontFamily = "SimSun";
pageSettings.FontSize = 16;
GenerationResult res = engine.generateTemplate("d:\\测试 - utf8.txt", pageSettings);
res.save(String.valueOf(Paths.get("d:\\")), "template-java");
}
public static void main(String[] args) throws Exception {
test();
}
public static void test() throws Exception {
String s = "?text=Hello, world! \r\n" +
"\tfont_style=bold\r\n" +
"\tfont_size=24\r\n" +
"\r\n" +
"#你今天你今天怎么样子? \r\n" +
"\t()Pretty good, thanks! () I won't respond until I see my lawyer.\r\n" +
"\t()很好你很好很好挖到! () I won't respond until I see my lawyer.\r\n" +
"#How are you doing today? \r\n" +
"\t()Pretty good, thanks! ()I won’t respond until I see my lawyer.\r\n";
Files.write(Paths.get("d:\\测试 - utf8.txt"), s.getBytes(StandardCharsets.UTF_8));
OmrEngine engine = new OmrEngine();
GlobalPageSettings pageSettings = new GlobalPageSettings();
pageSettings.FontFamily = "SimSun-ExtG";
pageSettings.FontSize = 16;
GenerationResult res = engine.generateTemplate("d:\\测试 - utf8.txt", pageSettings);
res.save(String.valueOf(Paths.get("d:\\")), "template-java");
public static void main(String[] args) throws Exception {
test();
}
public static void test() throws Exception {
String s = "?text=Hello, world! \r\n" +
"\tfont_style=bold\r\n" +
"\tfont_size=24\r\n" +
"\r\n" +
"#你今天你今天怎么子我的我的我的我的我的? \r\n" +
"\t()Pretty good, thanks! () I won't respond until I see my lawyer.\r\n" +
"\t()你今天你今天怎么子! () I won't respond until I see my lawyer.\r\n" +
"#How are you doing today? \r\n" +
"\t()Pretty good, thanks! ()I won’t respond until I see my lawyer.\r\n";
Files.write(Paths.get("d:\\测试 - utf8.txt"), s.getBytes(StandardCharsets.UTF_8));
OmrEngine engine = new OmrEngine();
GlobalPageSettings pageSettings = new GlobalPageSettings();
public static void main(String[] args) throws Exception {
test();
test2();
}
public static void test() throws Exception {
String s = "?text=Hello, world! \r\n" +
"\tfont_style=bold\r\n" +
"\tfont_size=24\r\n" +
"\r\n" +
"#你今天你今天怎么子我的我的我的我的我的? \r\n" +
"\t()Pretty good, thanks! () I won't respond until I see my lawyer.\r\n" +
"\t()你今天你今天怎么子! () I won't respond until I see my lawyer.\r\n" +
"#How are you doing today? \r\n" +
"\t()Pretty good, thanks! ()I won’t respond until I see my lawyer.\r\n";
Files.write(Paths.get("d:\\测试 - utf8.txt"), s.getBytes(StandardCharsets.UTF_8));
OmrEngine engine = new OmrEngine();
GlobalPageSettings pageSettings = new GlobalPageSettings();
GenerationResult res = engine.generateTemplate("d:\\测试 - utf8.txt", pageSettings);
BufferedImage templateImage = res.getTemplateImage();
File outputFile = new File("d:\\template-java1.png");
ImageIO.write(templateImage, "png", outputFile);
System.out.println("Image saved successfully to: " + outputFile.getAbsolutePath());
res.save(String.valueOf(Paths.get("d:\\")), "template-java");
}
public static void test2() throws Exception {
String s = "?text=Hello, world! \r\n" +
"\tfont_style=bold\r\n" +
"\tfont_size=24\r\n" +
"\r\n" +
"#你今天你今天怎么子我的我的我的我的我的? \r\n" +
"\t()Pretty good, thanks! () I won't respond until I see my lawyer.\r\n" +
"\t()你今天你今天怎么样子! () I won't respond until I see my lawyer.\r\n" +
"#How are you doing today? \r\n" +
"\t()Pretty good, thanks! ()I won’t respond until I see my lawyer.\r\n";
Files.write(Paths.get("d:\\测试 - utf8.txt"), s.getBytes(StandardCharsets.UTF_8));
OmrEngine engine = new OmrEngine();
GlobalPageSettings pageSettings = new GlobalPageSettings();
Agency FB
Algerian
Arial
Arial Black
Arial Narrow
Arial Rounded MT Bold
Arvo
Bahnschrift
Barlow Condensed
Barrio
Baskerville Old Face
Bauhaus 93
Bell MT
Berlin Sans FB
Berlin Sans FB Demi
Bernard MT Condensed
Blackadder ITC
Bodoni MT
Bodoni MT Black
Bodoni MT Condensed
Bodoni MT Poster Compressed
Book Antiqua
Bookman Old Style
Bookshelf Symbol 7
Bradley Hand ITC
Britannic Bold
Broadway
Brush Script MT
Bubblegum Sans
Cabin Sketch
Calibri
Calibri Light
Californian FB
Calisto MT
Cambria
Cambria Math
Candara
Candara Light
Cascadia Code
Cascadia Mono
Castellar
Centaur
Century
Century Gothic
Century Schoolbook
Chiller
Colonna MT
Comfortaa
Comic Sans MS
Consolas
Constantia
Cooper Black
Copperplate Gothic Bold
Copperplate Gothic Light
Corbel
Corbel Light
Courier New
Curlz MT
DejaVu Math TeX Gyre
DejaVu Sans Mono
Delius
Dialog
DialogInput
DIN Next LT Pro
DIN Next LT Pro Light
DIN Next LT Pro Medium
Dosis
Droid Serif
Dubai
Dubai Light
Dubai Medium
Ebrima
Edwardian Script ITC
Elephant
Engravers MT
Eras Bold ITC
Eras Demi ITC
Eras Light ITC
Eras Medium ITC
Felix Titling
Footlight MT Light
Forte
Franklin Gothic Book
Franklin Gothic Demi
Franklin Gothic Demi Cond
Franklin Gothic Heavy
Franklin Gothic Medium
Franklin Gothic Medium Cond
Fredericka the Great
Fredoka One
Freestyle Script
French Script MT
Gabriola
Gadugi
Garamond
Georgia
Gigi
Gill Sans MT
Gill Sans MT Condensed
Gill Sans MT Ext Condensed Bold
Gill Sans Ultra Bold
Gill Sans Ultra Bold Condensed
Gloucester MT Extra Condensed
Goudy Old Style
Goudy Stout
Haettenschweiler
Harlow Solid Italic
Harrington
High Tower Text
HoloLens MDL2 Assets
Impact
Imprint MT Shadow
Indie Flower
Informal Roman
Ink Free
Javanese Text
Jokerman
Juice ITC
Julius Sans One
Kristen ITC
Kunstler Script
Leelawadee
Leelawadee UI
Leelawadee UI Semilight
Lobster
Lucida Bright
Lucida Calligraphy
Lucida Console
Lucida Fax
Lucida Handwriting
Lucida Sans
Lucida Sans Typewriter
Lucida Sans Unicode
Magneto
Maiandra GD
Malgun Gothic
Malgun Gothic Semilight
Marlett
Matura MT Script Capitals
Megrim
Microsoft Himalaya
Microsoft JhengHei UI
Microsoft JhengHei UI Light
Microsoft New Tai Lue
Microsoft PhagsPa
Microsoft Sans Serif
Microsoft Tai Le
Microsoft Uighur
Microsoft YaHei UI
Microsoft YaHei UI Light
Microsoft Yi Baiti
Mistral
Modern No. 20
Mongolian Baiti
Monospaced
Monoton
Monotype Corsiva
MS Gothic
MS Outlook
MS PGothic
MS Reference Sans Serif
MS Reference Specialty
MS UI Gothic
MT Extra
MV Boli
Myanmar Text
Nanum Pen
Niagara Engraved
Niagara Solid
Nirmala UI
Nirmala UI Semilight
Noto Sans SC
NumberOnly
OCR A Extended
Old English Text MT
Onyx
Open Sans
Open Sans Semibold
Palace Script MT
Palatino Linotype
Pangolin
Papyrus
Parchment
Perpetua
Perpetua Titling MT
Playbill
Poiret One
Poor Richard
Pristina
Rage Italic
Raleway
Ravie
Roboto
Roboto Condensed
Roboto Slab
Rockwell
Rockwell Condensed
Rockwell Extra Bold
SansSerif
Script MT Bold
Segoe MDL2 Assets
Segoe Print
Segoe Script
Segoe UI
Segoe UI Black
Segoe UI Emoji
Segoe UI Historic
Segoe UI Light
Segoe UI Semibold
Segoe UI Semilight
Segoe UI Symbol
Serif
Shadows Into Light
Showcard Gothic
SimSun-ExtB
SimSun-ExtG
Sitka Banner
Sitka Display
Sitka Heading
Sitka Small
Sitka Subheading
Sitka Text
Snap ITC
Source Sans Pro
Source Sans Pro Black
Source Sans Pro Light
Source Sans Pro SemiBold
Stencil
Sylfaen
Symbol
Tahoma
Tempus Sans ITC
Times New Roman
Trebuchet MS
Tw Cen MT
Tw Cen MT Condensed
Tw Cen MT Condensed Extra Bold
Vast Shadow
Verdana
Viner Hand ITC
Vivaldi
Vladimir Script
Webdings
Wide Latin
Wingdings
Wingdings 2
Wingdings 3
Yu Gothic
Yu Gothic Light
Yu Gothic Medium
Yu Gothic UI
Yu Gothic UI Light
Yu Gothic UI Semibold
Yu Gothic UI Semilight
Zilla Slab
仿宋
华文中宋
华文仿宋
华文宋体
华文彩云
华文新魏
华文楷体
华文琥珀
华文细黑
华文行楷
华文隶书
宋体
幼圆
微軟正黑體
微軟正黑體 Light
微软雅黑
微软雅黑 Light
新宋体
新細明體-ExtB
方正兰亭超细黑简体
方正姚体
方正粗黑宋简体
方正舒体
楷体
汉仪中黑 197
等线
等线 Light
細明體-ExtB
細明體_HKSCS-ExtB
隶书
黑体
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.