pdf之五 簡體中文輸出

2021-06-16 08:15:21 字數 2323 閱讀 2689

般來說, 每種基本字型,都會有在其基礎上變化字形的附加字型。比如,字型arial, 就有其附加字型arial bold(粗體), arialitalic(斜體), 及arial bolditalic(粗斜體)。一般你都可以找到或購買到相應的附加字型。

但有時為了應急,或對字型字形沒有非常嚴格的要求。在這樣的情況下,我們可以採用人工字形生成(artificial font styles)。artificial font styles是acrobat的乙個功能,它根據基本字形而模擬生成粗體,斜體及粗斜體。pdflib支援這一功能,並遵守acrobat對此功能的限制。目前此功能之侷限於:

1.acrobat標準字型, 就簡體中文來說也就是pdflib自帶的stsong-light,adobesongstd-light-acro,及stsongstd-light-acro三種簡體中文本型。

2.pdflib可以訪問的.otf opentype字型,並使用表1.1的編碼(見《**pdflib中文輸出(一)》), 且「embedding」引數設為假。

#include

#include

#include

#include"pdflib.h"

intmain(void)

pdf_try(p)

pdf_set_info(p, "creator", "pdflib_cs5.c");

pdf_set_info(p, "author", "[email protected]");

pdf_set_info(p, "title", "usage of artificial font styles");

pdf_begin_page_ext(p, a4_width, a4_height, "");

font_h =pdf_load_font(p, "helvetica-bold", 0, "winansi", "");

pdf_setfont(p, font_h, 24);

pdf_show_xy(p, "artificial font styles", left +100,  y);

y -= 2 *incry;

pdf_setfont(p, font_h, 14);

pdf_show_xy(p, "normal", left,  y);

y -=incry;

font_cs =pdf_load_font(p, "stsong-light", 0, "unigb-ucs2-h", "");

pdf_setfont(p, font_cs, 14);

pdf_show_xy2(p, textunicode, textlen, left, y);

y -= 2 *incry;

pdf_setfont(p, font_h, 14);

pdf_show_xy(p, "italic", left,  y);

y -=incry;

font_cs =pdf_load_font(p, "stsong-light", 0, "unigb-ucs2-h", "fontstyleitalic");

pdf_setfont(p, font_cs, 14);

pdf_show_xy2(p, textunicode, textlen, left, y);

y -= 2 *incry;

pdf_setfont(p, font_h, 14);

pdf_show_xy(p, "bold", left,  y);

y -=incry;

font_cs =pdf_load_font(p, "stsong-light", 0, "unigb-ucs2-h", "fontstylebold");

pdf_setfont(p, font_cs, 14);

pdf_show_xy2(p, textunicode, textlen, left, y);

y -= 2 *incry;

pdf_setfont(p, font_h, 14);

pdf_show_xy(p, "bold-italic", left,  y);

y -=incry;

font_cs =pdf_load_font(p, "stsong-light", 0, "unigb-ucs2-h",

"fontstylebolditalic");

pdf_setfont(p, font_cs, 14);

pdf_show_xy2(p, textunicode, textlen, left, y);

pdf_end_page_ext(p, "");

pdf_end_document(p, "");

} pdf_catch(p)

pdf_delete(p);

return0; }

簡體中文Win7開啟簡體中文chm中文亂碼解決方法

簡體中文win7開啟簡體中文chm中文亂碼解決方法 regedit,在hkey current user software microsoft internet explorer international下增加名為autodetect型別為dword值為1的鍵值。其實在windows下開啟chm檔...

簡體中文轉換正體中文

簡體中文 從老於那裡得到一段 string str1 小調三丁 劍羽斬 string str2 string str3 str2 microsoft.visualbasic.strings.strconv str1,microsoft.visualbasic.vbstrconv.traditiona...

hurricane中文 奠基簡體中文免安裝版

重要提示!中文設定 將setting中的language換成簡體中文即可。遊戲介紹 奠基 foundation 是polymorph games製作並發行的一款中世紀風格的城市建造模擬遊戲,在遊戲中玩家將擁有一片廣大的區域,在其中你可以建造出屬於你的世界,修道院 居民區 紀念碑等建築全部在你的設計之...