平衡点


2007/11/12

_ Adobe Reader 8 の日本語フォント[Computer] [Debian] 

まだまだ環境再構築中. TeX 環境 を整えてて, Adobe Reader が無い事に気がついた. Adobe 本家「Adobe - Adobe Readerのダウンロード - すべてのバージョン」で, deb パッケージ(Linux x86 deb )が配布されている

...が,

  • install したら勝手に ~/Desktop が作成された.
    • しかも root 権限で.
  • 日本語フォントは, 相変わらずゴシック体が無い.
    • なんででしょう.

install 場所が /opt なのは, まあ良いにしても, なんで ~/Desktop なんでしょう. みんな konqueror(うろ覚え) とか nautilus(うろ覚え)とか使ってんのかなぁ. やっぱ.

嫌な気分になったので, 大人しく <URL:http://www.debian-multimedia.org/:title> の acroread パッケージを使う事に(日本語版じゃないけど).

ついでに, 日本語フォント installer を作りました. <URL:http://www.gfd-dennou.org/arch/uwabami/pub/:title> に置いておきます.

deb http://www.gfd-dennou.org/arch/uwabami/pub/etch ./
もしくは
deb http://www.gfd-dennou.org/arch/uwabami/pub/lenny ./

で取得できます. acroread-jpnfont です(要 debian-multimedia の acroread パッケージ).


2009/11/12

_ asymptote で緯度経度動径座標系[Work] 

D 論用に座標系を書くためにasymptote で座標系の絵を描こうとしてジタバタしていた.

コードは汚いけれどとりあえずできたのではっつける.

  • Arrow3 で矢印のサイズを変更するにはどうするんだろう...
    • (2009/11/13 追記) Arrow3(size=10) とかでイイみたい. 初歩だ.
//
// longitude-latitude-radial(spherical) coordinate.
//
usepackage("txfonts");
import solids;
//settings.render=0;
settings.prc=false;

// screen settings
size(400,0);
currentprojection=orthographic(0,4,2,center=true);

//pen settings
pen dark=darkcyan;
pen sp=cyan;
defaultpen(linewidth(2));
defaultpen(fontsize(16));

//parameter settings
real xi=0.35;
triple origin=(0,0,0);

// definition x, y, z
real x(real rad, real lambda, real vphi) { return rad*cos(lambda)*cos(vphi);}
real y(real rad, real lambda, real vphi) { return rad*sin(lambda)*cos(vphi);}
real z(real rad, real vphi) { return rad*sin(vphi);}

// inner core
real r_in_radius=xi/(1-xi);
revolution r_in_sphere=sphere(r_in_radius);
draw(r_in_sphere,sp+linewidth(1),m=1,longitudinalpen=nullpen);
draw(r_in_sphere.silhouette(),sp+linewidth(2));
triple vect_r_in=(x(rad=r_in_radius, lambda=0, vphi=45*pi/180),
                  y(rad=r_in_radius, lambda=0, vphi=45*pi/180),
                  z(rad=r_in_radius, vphi=45*pi/180));
path3 r_in=origin..vect_r_in;
draw(r_in,dark,Arrow3(size=10));
label("$r_{i}$",r_in,NE);

// outer core
real r_out_radius=1/(1-xi);
revolution r_out_sphere=sphere(r_out_radius);
draw(r_out_sphere,sp+linewidth(1),m=1,longitudinalpen=nullpen);
draw(r_out_sphere.silhouette(),sp+linewidth(2));
triple vect_r_out=(x(rad=r_out_radius, lambda=30*pi/180, 0),
                   y(rad=r_out_radius, lambda=30*pi/180, 0),
                   z(rad=r_out_radius, 0));
path3 r_out=origin..vect_r_out;
draw(r_out,dark,Arrow3(size=10));
label("$r_{o}$",r_out,SE);

// radis d
path3 length_scale=(r_in_radius,0,0)..(r_out_radius,0,0);
draw(length_scale,black,Arrows3(size=10));
label("$D=r_{o}-r_{i}$",(1,0,0),N);

// gravity g
triple vect_g_in=(x(rad=1.4,lambda=0,vphi=60*pi/180),
                  y(rad=1.4,lambda=0,vphi=60*pi/180),
                  z(rad=1.4,vphi=60*pi/180));
triple vect_g_out=(x(rad=0.8,lambda=0,vphi=60*pi/180),
                   y(rad=0.8,lambda=0,vphi=60*pi/180),
                   z(rad=0.8,vphi=60*pi/180));
path3 gravity=vect_g_in..vect_g_out;
draw(gravity,black,Arrow3(size=10));
label("$\mathbf{g}$",gravity,N);

// rotation axis
triple vect_rad_axis=(x(rad=r_out_radius, lambda=0, vphi=90*pi/180),
                      y(rad=r_out_radius, lambda=0, vphi=90*pi/180),
                      z(rad=r_out_radius, vphi=90*pi/180));
draw(origin..vect_rad_axis,dark+dashed+linewidth(1));
draw((0,0,vect_rad_axis.z+0.05)..(0,0,r_out_radius+0.3),
     dark+solid,Arrow3(size=10));
draw(arc((r_out_radius+0.2)*Z,0.1,90,-20,90,160),dark,Arrow3(size=10));
label("$\mathbf{\Omega}=\Omega\mathbf{k}$",(0,0,r_out_radius+0.5),SE);

// position vector
real r_pos_radius=0.7*(1+xi)/(1-xi);
triple vect_pos=(x(rad=r_pos_radius, lambda=140*pi/180, vphi=60*pi/180),
                 y(rad=r_pos_radius, lambda=140*pi/180, vphi=60*pi/180),
                 z(rad=r_pos_radius, vphi=60*pi/180));
draw(origin..vect_pos,dark,Arrow3(size=10));
label("$\mathbf{r}$",
      origin..(vect_pos.x*1.5,vect_pos.y*1.5,vect_pos.z*1.5),NW);

// lambda
draw(origin..(vect_pos.x,vect_pos.y,0),dark+dashed+linewidth(1));
draw(vect_pos..(vect_pos.x,vect_pos.y,0),dark+dashed+linewidth(1));
triple vect_lambda=(x(rad=r_out_radius, lambda=100*pi/180, vphi=0),
                    y(rad=r_out_radius, lambda=100*pi/180, vphi=0),
                    z(rad=r_out_radius, vphi=0));
draw(origin..vect_lambda,dark+dashed+linewidth(1));
path3 l_lambda=arc(origin,
                   (vect_pos.x,vect_pos.y,0),
                   (vect_lambda.x,vect_lambda.y,0),CCW);
draw(reverse(l_lambda),dark,Arrow3(size=10));
label("$\lambda$",l_lambda,SW);

// phi
path3 l_phi=arc(origin,
                (0.5*vect_pos.x,0.5*vect_pos.y,0),
                (0.5*vect_pos.x,0.5*vect_pos.y,0.5*vect_pos.z),CCW);
draw(l_phi,dark+linewidth(2),Arrow3(size=10));
label("$\varphi$",l_phi,E);

結果はこんな感じ.


2011/11/12

_ ただダラと posttdiary{-ex}.rb[Ruby] [tDiary] 

今んところ, ただダラ(リンク先ドコー?) + simple-hatena-diray の修正版でコレを書いているのだけれど. postdiarxy{-ex}.rb を使うようにしてみた方が良いのだろうか...

んー...

_ rdtool-0.6.31[Ruby] 

とりあえず ruby-list にアナウンスを投げてみた.

@see https://github.com/uwabami/rdtool/

気にしていること

  • ruby1.9 で rd2man-lib の出力がおかしいような...
  • github って tar.gz のファイル名固定できなかったっけ? あれ?
  • setup.rb から脱却した方が良いかな

そんなこんなで.


2018/11/12

_ TeXConf 2018[Computer] 

参加してきました.

そういえば, SATySFi の薄い本も買ってしまった…

_ Drum Paradise - 菅沼孝三[CD] 

ちょっとドラム以外も騒々しい, 様な(笑)

Drum Paradise Drum Paradise
菅沼孝三, キングレコード

まあ, これはこれで.


2026/11/12

_ tmux での結合文字処理: VS15 編

はじめに

最近の tmux には

set -s variation-selector-always-wide on

という設定があります. これは「VS16 を含む emoji presentation は wideとして扱う」という処理を行なっています. 絵文字が綺麗に表示されて嬉しいですね.

コード自体は utf8-combined.c

/* Is this variation selector U+FE0F? */
int
utf8_is_vs(const struct utf8_data *ud)
{
	if (ud->size != 3)
		return (0);
	return (memcmp(ud->data, "\357\270\217", 3) == 0);
}

と screen-write.c の

/* Combine a UTF-8 zero-width character onto the previous if necessary. */
static int
screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
{
...
	/*
	 * Is this character which makes no sense without being combined? If
	 * this is true then flag it here and discard the character (return 1)
	 * if we cannot combine it.
	 */
	if (utf8_is_zwj(ud))
		zero_width = 1;
	else if (utf8_is_vs(ud)) {
		zero_width = 1;
		if (options_get_number(oo, "variation-selector-always-wide"))
			force_wide = 1;
	} else if (ud->width == 0)
		zero_width = 1;
...
	/*
	 * Redraw the combined cell. If forcing the cell to width 2, reset the
	 * cached cursor position in the tty, since we don't really know
	 * whether the terminal thought the character was width 1 or width 2
	 * and what it is going to do now.
	 */
	screen_write_set_cursor(ctx, cx - n, cy);
	screen_write_initctx(ctx, &ttyctx, 0, 0);
	ttyctx.cell = &last;
	if (force_wide)
		ttyctx.flags |= TTY_CTX_CELL_INVALIDATE;
	if (screen_write_should_draw_line(ctx, cy))
		tty_write(tty_cmd_cell, &ttyctx);
	screen_write_set_cursor(ctx, cx, cy);

	return (1);
}

といった辺りかな.

処理としては どんな文字でも 0xFE0F が後置されていたら全角幅で表示する, でしょうか. 0xFE0F がつくのは主に絵文字なので, 処理としてはこれで良いかもしれません.

何がしたいの?

で, 本題.

VS15 というセレクタが付いた文字が weechat on tmux に入ってきて pane 罫線がブレブレになりました.

Variation Selector には

  • VS16(0xFE0F): emoji-style with color
  • VS15(0xFE0E): text-style with monochrome

と二つがあって

  • 文字 + 0xFE0F → (色付き)絵文字, 全角幅
  • 絵文字 + 0xFE0E → 文字, 半角全角は East Asian ambiguous char Width の扱い次第

となるわけですね.

現在使っているターミナルは foot もしくは Ghostty なので, East Asian ambiguous char Width で N, A は半角幅にしています. なので VS15 が後置されている文字は強制的に文字幅を減らしたい, と考えます.

どうするの?: tmux の修正

こういうのはどうかな?

From: Youhei SASAKI <uwabami@gfd-dennou.org>
Date: Thu, 12 Nov 2026 10:19:32 +0900
Subject: Handling VS15 selector

Signed-off-by: Youhei SASAKI <uwabami@gfd-dennou.org>
---
 screen-write.c  | 22 ++++++++++++++++++----
 utf8-combined.c |  6 +++++-
 2 files changed, 23 insertions(+), 5 deletions(-)

--- a/screen-write.c
+++ b/screen-write.c
@@ -2859,6 +2859,7 @@
 	struct tty_ctx		 ttyctx;
 	int			 force_wide = 0, zero_width = 0;
 	int			 xoff = 0, yoff = 0;
+	int			 force_narrow = 0, vs;
 	struct visible_ranges	*r;
 
 	/* Ignore U+3164 HANGUL_FILLER entirely. */
@@ -2872,10 +2873,14 @@
 	 */
 	if (utf8_is_zwj(ud))
 		zero_width = 1;
-	else if (utf8_is_vs(ud)) {
+	else if ((vs = utf8_is_vs(ud)) != 0) {
 		zero_width = 1;
-		if (options_get_number(oo, "variation-selector-always-wide"))
-			force_wide = 1;
+		if (vs == 16) {
+		  if (options_get_number(oo, "variation-selector-always-wide"))
+		    force_wide = 1;
+		} else if (vs == 15) {
+		  force_narrow = 1;
+		}
 	} else if (ud->width == 0)
 		zero_width = 1;
 
@@ -2942,6 +2947,15 @@
 	} else
 		force_wide = 0;
 
+	/* Force the width to 1 for variation selector 15 (U+FE0E). */
+	if (last.data.width == 2 && force_narrow) {
+		last.data.width = 1;
+		n = 1;
+		cx--;
+		grid_view_set_cell(gd, cx, cy, &grid_default_cell);
+	} else
+		force_narrow = 0;
+
 	/* Set the new cell. */
 	grid_view_set_cell(gd, cx - n, cy, &last);
 	if (force_wide)
@@ -2976,7 +2990,7 @@
 	screen_write_set_cursor(ctx, cx - n, cy);
 	screen_write_initctx(ctx, &ttyctx, 0, 0);
 	ttyctx.cell = &last;
-	if (force_wide)
+	if (force_wide || force_narrow)
 		ttyctx.flags |= TTY_CTX_CELL_INVALIDATE;
 	if (screen_write_should_draw_line(ctx, cy))
 		tty_write(tty_cmd_cell, &ttyctx);
--- a/utf8-combined.c
+++ b/utf8-combined.c
@@ -70,7 +70,11 @@
 {
 	if (ud->size != 3)
 		return (0);
-	return (memcmp(ud->data, "\357\270\217", 3) == 0);
+	if (memcmp(ud->data, "\357\270\217", 3) == 0)
+		return (16);
+	if (memcmp(ud->data, "\357\270\216", 3) == 0)
+		return (15);
+	return (0);
 }
 
 /* Is this Hangul filler U+3164? */

オプションで処理を切り替えられた方が良いかも.

結論

とりあえず

printf "\r\u26aa\ufe0e\e[6n"; IFS=';' read -rs -d R _ col; echo " col=$col"

の結果が foot でも tmux でも

⚪︎ col=2

に揃う様になったのでヨシとする…?

いや, 多分 emoji-variation-sequences.txt を確認してちゃんと処理しないといけないんだろうけど. また困ったら考えよう.


連絡先など

portrait

最近の日記

一覧

Back to Top ▲