OSDN Git Service

new function pdf_out_char.
authormaqiyuan <maqiyuan@users.sourceforge.jp>
Fri, 22 Aug 2014 06:47:36 +0000 (14:47 +0800)
committermaqiyuan <maqiyuan@users.sourceforge.jp>
Fri, 22 Aug 2014 06:47:36 +0000 (14:47 +0800)
src/texsourc/dpx.c
src/texsourc/dpx.h

index b950946..f183bee 100644 (file)
@@ -119,6 +119,9 @@ void pdf_ship_out (pointer p)
     pdf_doc_set_creator("TeX");\r
     pdf_files_init();\r
     pdf_init_device(0.000015202, 2, 0);\r
+    // TODO: pdfTeX's page width and height.\r
+    // page_width  = pdf_page_width  != 0 ? <- : width(p)             + 2 * (pdf_h_origin + h_offset);\r
+    // page_height = pdf_page_height != 0 ? <- : height(p) + depth(p) + 2 * (pdf_v_origin + v_offset);\r
     pdf_open_document(pdf_file_name, 0, 595.0, 842.0, 0, 0, (1 << 4));\r
     spc_exec_at_begin_document();\r
   }\r
@@ -199,6 +202,19 @@ int pdf_get_font_id (internal_font_number f)
   return id;\r
 }\r
 \r
+void pdf_out_char (internal_font_number f, ASCII_code c)\r
+{\r
+  pdf_rect rect;\r
+  char cbuf[2];\r
+  cbuf[0] = c;\r
+  cbuf[1] = 0;\r
+  pdf_dev_set_string(cur_h, -cur_v, cbuf, 1, char_width(f, char_info(f, c)), font_id[f], 1);\r
+  pdf_dev_set_rect(&rect, cur_h, -cur_v, char_width(f, char_info(f, c)),\r
+      char_height(f, height_depth(char_info(f, c))),\r
+      char_depth(f, height_depth(char_info(f, c))));\r
+  pdf_doc_expand_box(&rect);\r
+}\r
+\r
 void pdf_hlist_out (void)\r
 {\r
   scaled base_line;\r
@@ -258,16 +274,7 @@ reswitch:
         dvi_f = f;\r
       }\r
 \r
-      char cbuf[2] = {c, 0};\r
-      pdf_dev_set_string(cur_h, -cur_v, cbuf, 1, char_width(f, char_info(f, c)), font_id[dvi_f], 1);\r
-      {\r
-        pdf_rect rect;\r
-        pdf_dev_set_rect(&rect, cur_h, -cur_v,\r
-          char_width (f, char_info(f, c)),\r
-          char_height(f, height_depth(char_info(f, c))),\r
-          char_depth (f, height_depth(char_info(f, c))));\r
-        pdf_doc_expand_box(&rect);\r
-      }\r
+      pdf_out_char(dvi_f, c);\r
       cur_h = cur_h + char_width(f, char_info(f, c));\r
       p = link(p);\r
     } while (!(!is_char_node(p)));\r
index 25bc68a..7d2ad4b 100644 (file)
@@ -49,3 +49,4 @@ extern void pdf_dev_set_rect (pdf_rect *rect,
                   spt_t x_user, spt_t y_user,\r
                   spt_t width,  spt_t height, spt_t depth);\r
 extern void pdf_doc_expand_box (const pdf_rect *rect);\r
+extern void pdf_out_char(internal_font_number f, ASCII_code c);
\ No newline at end of file