[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[mgp-users-jp 00552] patch3兄弟
- To: mgp-users-jp@mew.org
- Subject: [mgp-users-jp 00552] patch3兄弟
- From: Yasunori HANADA <yasunori@swlab.csce.kyushu-u.ac.jp>
- Date: Sat, 26 Jun 1999 21:12:51 +0900
- Posted: Sat, 26 Jun 1999 21:12:44 +0900
- Reply-to: mgp-users-jp@mew.org
花田@九大です。
3つpatchを作りました。おためしあれ。
1. 箇条書のあとに文字サイズが戻るようになるpatch(TABresume.patch)
箇条書の次の本文の文字サイズが、箇条書の文字サイズに引きずられるのを解
消。これまでと互換性が無くなるのでその辺の影響は大。
こんな時に有効(↓)
本文1(size 5)
箇条書1(size 5)
箇条書2(size 4)
本文2(size 4)
このpatchで、本文2の文字サイズが本文1と同じになります。
2. configure でdefaultのガイドフォントを指定するpatch(CfgGl.patch)
mgp.hを書換えればすむ話なんですが、configure で指定できるようになりま
す。かなり処理がいいかげんになってます。patchを当てたあとに autoconfを
実行してconfigureを作り直す必要があります。(patchがデカくて添付する気
にならなかった:-)
3. preamble でガイドフォントを指定できるようにするpatch(Guideline.patch)
どこでも変更できるのを作ろうとして諦めました。とりあえず preamble で以
下のようにで指定できます。無いfontを指定すると、Segmentation faultで落
ちます。
%gfont "a14"
%kgfont "k14"
すべてdirty hack、alpha quality、無責任、無保証です。
mgp-snap-990621で作りましたが、1.05aにも当たるはずです。
--
yasunori // もし同じのが2通来てたらごめんなさい。
diff -ur mgp-snap-990621.DIST/draw.c mgp-snap-990621.TABresume/draw.c
--- mgp-snap-990621.DIST/draw.c Tue Jun 8 11:43:58 1999
+++ mgp-snap-990621.TABresume/draw.c Sat Jun 26 09:05:46 1999
@@ -37,6 +37,7 @@
static Image *bg_image[2] = {NULL, NULL};
static XImageInfo *bg_ximageinfo[2] = {NULL, NULL};
struct render_state cache_state;
+static u_int saved_fontsize = 0;
static u_short kinsokutable[] = {
0x2121, 0x2122, 0x2123, 0x2124, 0x2125, 0x2126, 0x2127, 0x2128,
@@ -660,6 +661,16 @@
if (t_fin)
timebar(state);
+ }
+ if (cp->ct_tab){
+ if (!saved_fontsize) /* initialize */
+ saved_fontsize = char_size[caching];
+ }else if (saved_fontsize){
+ char_size[caching] = saved_fontsize;
+#ifdef FREETYPE
+ tfc_setsize(char_size[caching]);
+#endif
+ saved_fontsize = 0;
}
draw_line_start(state);
break;
diff -ur mgp-snap-990621.DIST/mgp.h mgp-snap-990621.TABresume/mgp.h
--- mgp-snap-990621.DIST/mgp.h Mon Jun 7 02:55:18 1999
+++ mgp-snap-990621.TABresume/mgp.h Sat Jun 26 09:28:01 1999
@@ -266,6 +266,7 @@
u_char ct_op;
u_char ct_flag;
u_int ct_page;
+ u_int ct_tab;
struct ctrl *ct_next;
union {
struct ctrl_double ctrl_double;
diff -ur mgp-snap-990621.DIST/parse.c mgp-snap-990621.TABresume/parse.c
--- mgp-snap-990621.DIST/parse.c Mon Dec 28 17:22:37 1998
+++ mgp-snap-990621.TABresume/parse.c Sat Jun 26 09:09:14 1999
@@ -1104,10 +1104,13 @@
free(tmp);
}
+ cp1->ct_tab = tab_depth + 1;
if (tab_control[tab_depth]) {
ctlinsert(&cp1->ct_next,
ctlcopy(tab_control[tab_depth]));
}
+ }else{
+ cp1->ct_tab = 0;
}
/* special: style escape */
if (p && *p == '&') {
diff -ur mgp-snap-990621.DIST/print.c mgp-snap-990621.TABresume/print.c
--- mgp-snap-990621.DIST/print.c Tue May 25 18:44:30 1999
+++ mgp-snap-990621.TABresume/print.c Sat Jun 26 09:06:54 1999
@@ -39,6 +39,7 @@
static char *tabprefix = NULL;
static u_int lineheight;
static u_int linewidth;
+u_int saved_fontsize = 0;
#define DEFAULT_PAPER_SIZE "a4"
#define PRINT_ASCIIFONT "Times-Roman"
@@ -704,6 +705,13 @@
break;
case CTL_LINESTART:
+ if (cp->ct_tab){
+ if (!saved_fontsize) /* initialize */
+ saved_fontsize = char_size[caching];
+ }else if (saved_fontsize){
+ char_size[caching] = saved_fontsize;
+ saved_fontsize = 0;
+ }
line_start();
break;
diff -ur mgp-snap-990621.DIST/configure.in mgp-snap-990621.CfgGl/configure.in
--- mgp-snap-990621.DIST/configure.in Wed Jun 9 05:00:41 1999
+++ mgp-snap-990621.CfgGl/configure.in Sat Jun 26 13:22:09 1999
@@ -220,6 +220,28 @@
fi
fi
+AC_MSG_CHECKING(for guide font)
+AC_ARG_WITH(guide_font, [ --with-guide-font=FONT use FONT as guidefont])
+if test "x$with_guide_font" = "x" -o "$with_guide_font" = "yes"; then
+ mgp_pagelist_font="a14"
+ AC_MSG_RESULT(use default guide font)
+else
+ mgp_pagelist_font=$with_guide_font
+ AC_MSG_RESULT($mgp_pagelist_font)
+fi
+AC_SUBST(mgp_pagelist_font)
+
+AC_MSG_CHECKING(for kanji guide font)
+AC_ARG_WITH(guide_kfont, [ --with-guide-kfont=FONT use FONT as kanji guidefont])
+if test "x$with_guide_kfont" = "x" -o "$with_guide_kfont" = "yes"; then
+ mgp_pagelist_kfont="k14"
+ AC_MSG_RESULT(use default kanji guide font)
+else
+ mgp_pagelist_kfont=$with_guide_kfont
+ AC_MSG_RESULT($mgp_pagelist_kfont)
+fi
+AC_SUBST(mgp_pagelist_kfont)
+
dnl Checks for header files.
AC_PATH_X
AC_HEADER_STDC
@@ -246,7 +268,7 @@
AC_SUBST(mgp_keywords)
AC_OUTPUT(Imakefile image/Imakefile sample/Imakefile
- contrib/mgp2html.pl contrib/mgp2latex.pl contrib/mgpnet mgpembed.pl)
+ contrib/mgp2html.pl contrib/mgp2latex.pl contrib/mgpnet mgpembed.pl gfont.h)
/bin/rm -f Makefile image/Makefile
diff -ur mgp-snap-990621.DIST/gfont.h.in mgp-snap-990621.CfgGl/gfont.h.in
--- mgp-snap-990621.DIST/gfont.h.in Sat Jun 26 13:17:30 1999
+++ mgp-snap-990621.CfgGl/gfont.h.in Sat Jun 26 13:22:09 1999
@@ -0,0 +1,2 @@
+#define PAGELIST_FONT "@mgp_pagelist_font@"
+#define PAGELIST_KFONT "@mgp_pagelist_kfont@"
diff -ur mgp-snap-990621.DIST/mgp.h mgp-snap-990621.CfgGl/mgp.h
--- mgp-snap-990621.DIST/mgp.h Mon Jun 7 02:55:18 1999
+++ mgp-snap-990621.CfgGl/mgp.h Sat Jun 26 13:22:09 1999
@@ -62,6 +62,7 @@
#include <X11/cursorfont.h>
#include <X11/Xatom.h>
#include "image/xloadimage.h"
+#include "gfont.h"
#ifndef __P
# define __P(x) x
@@ -97,8 +98,6 @@
#define DEFAULT_FORE "yellow"
#define DEFAULT_BACK "black"
-#define PAGELIST_FONT "a14"
-#define PAGELIST_KFONT "k14"
#define DEFAULT_CHARSIZE 10 /* 10% of height */
#define DEFAULT_HGAP 10
diff -ur mgp-snap-990621.DIST/globals.c yas-mgp-snap-990621/globals.c
--- mgp-snap-990621.DIST/globals.c Mon Jun 7 02:55:13 1999
+++ yas-mgp-snap-990621/globals.c Thu Jun 24 18:43:00 1999
@@ -142,5 +142,7 @@
/*CTL*/ { CTL_CHARSET, T_STR, "charset", 7 },
/*CTL*/ { CTL_TMFONT, T_STR, "tmfont", 6 },
/*CTL*/ { CTL_PCACHE, T_SP, "pcache", 6 },
+/*CTL*/ { CTL_GFONT, T_STR, "gfont", 5 },
+/*CTL*/ { CTL_KGFONT, T_STR, "kgfont", 6 },
{ 0, 0, NULL, 0 },
};
diff -ur mgp-snap-990621.DIST/grammar.y yas-mgp-snap-990621/grammar.y
--- mgp-snap-990621.DIST/grammar.y Tue Jun 8 16:08:40 1999
+++ yas-mgp-snap-990621/grammar.y Thu Jun 24 19:07:24 1999
@@ -664,7 +664,7 @@
%token KW_LINESTART KW_LINEEND KW_MARK KW_SYSTEM KW_FILTER KW_ENDFILTER
%token KW_QUALITY KW_ICON KW_LEFTFILL KW_XSYSTEM KW_VFCAP KW_TFONT KW_TFDIR
%token KW_DEFFONT KW_FONT KW_TFONT0 KW_EMBED KW_ENDEMBED KW_NEWIMAGE
-%token KW_CHARSET KW_TMFONT KW_PCACHE
+%token KW_CHARSET KW_TMFONT KW_PCACHE KW_GFONT KW_KGFONT
%type <ct> toplevel
%type <ct> line defaultline tabline shellline deffontline
@@ -891,6 +891,8 @@
{ $$ = gen_pcache($2, $3, $4, $5); }
| KW_PCACHE NUM
{ $$ = gen_pcache($2, 0, 0, 0); }
+ | KW_GFONT STR { $$ = gen_str(CTL_GFONT, $2); }
+ | KW_KGFONT STR { $$ = gen_str(CTL_KGFONT, $2); }
;
tabcmd: KW_TAB NUM { $$ = gen_int(CTL_TAB, $2); }
| KW_TAB ID { $$ = gen_str(CTL_TAB, $2); }
diff -ur mgp-snap-990621.DIST/parse.c yas-mgp-snap-990621/parse.c
--- mgp-snap-990621.DIST/parse.c Mon Dec 28 17:22:37 1998
+++ yas-mgp-snap-990621/parse.c Sat Jun 26 05:41:41 1999
@@ -59,6 +59,8 @@
static int filterval = 0;
+char *guide_font=NULL, *guide_kfont=NULL;
+
void
load_file(filename)
char *filename;
@@ -400,6 +402,12 @@
exit(-1);
}
break;
+ case CTL_GFONT:
+ guide_font = root->ctc_value;
+ break;
+ case CTL_KGFONT:
+ guide_kfont = root->ctc_value;
+ break;
default:
fprintf(stderr, "%s:%d: invalid operator\n",
diff -ur mgp-snap-990621.DIST/scanner.l yas-mgp-snap-990621/scanner.l
--- mgp-snap-990621.DIST/scanner.l Mon Jun 7 02:55:19 1999
+++ yas-mgp-snap-990621/scanner.l Thu Jun 24 18:48:09 1999
@@ -160,7 +160,9 @@
(EMBED|embed) return KW_EMBED;
(ENDEMBED|endembed) return KW_ENDEMBED;
(CHARSET|charset) return KW_CHARSET;
-(PCACHE|pcache) return KW_PCACHE;
+(PCACHE|pcache) return KW_PCACHE;
+(GFONT|gfont) return KW_GFONT;
+(KGFONT|kgfont) return KW_KGFONT;
[ \n\t] ;
"," return COMMA;
diff -ur mgp-snap-990621.DIST/x11.c yas-mgp-snap-990621/x11.c
--- mgp-snap-990621.DIST/x11.c Thu May 27 12:22:53 1999
+++ yas-mgp-snap-990621/x11.c Fri Jun 25 18:20:11 1999
@@ -71,6 +71,8 @@
int window_x;
int window_y;
+extern char *guide_font, *guide_kfont;
+
static Visual *
get_visual(display, screen, depthp)
Display *display;
@@ -281,8 +283,17 @@
gc_plrev = XCreateGC(display, window, 0, 0);
gc_pta = XCreateGC(display, window, 0, 0);
gc_ptk = XCreateGC(display, window, 0, 0);
- plfs = XLoadQueryFont(display, PAGELIST_FONT);
- plkfs = XLoadQueryFont(display, PAGELIST_KFONT);
+
+ if (!guide_font){
+ plfs = XLoadQueryFont(display, PAGELIST_FONT);
+ }else{
+ plfs = XLoadQueryFont(display, guide_font);
+ }
+ if (!guide_kfont){
+ plkfs = XLoadQueryFont(display, PAGELIST_KFONT);
+ }else{
+ plkfs = XLoadQueryFont(display, guide_kfont);
+ }
if (plfs) {
XSetFont(display, gc_pl, plfs->fid);
XSetFont(display, gc_plrev, plfs->fid);