※上記の広告は60日以上更新のないWIKIに表示されています。更新することで広告が下部へ移動します。

LTalk2::Font


フォントをインクルードで制御する。

// フォントを初期化する
LTalk2_Font_init:
	LTalk2_Font["Size"] = 10		
	LTalk2_Font["Family"] = "ゴシック"	
	LTalk2_Font["Weight"] = "00"		// 左から順にBoldフラグ, Italicフラグ。Regularが"00"
	LTalk2_Font["Color"] = "#000000"	
Return
 
// getter
LTalk2_Font_getSize:
Return LTalk2_Font["Size"]
LTalk2_Font_getFamily:
Return LTalk2_Font["Family"]
LTalk2_Font_getWeight
Return LTalk2_Font["Weight"]
LTalk2_Font_getColor
Return LTalk2_Font["Color"]
 
// フォントの規定値を変更する
// @param Args(1) size
// @param Args(2) family
// @param Args(3) weight
// @param Args(4) color
LTalk2_Font_set:
	LTalk2_Font_setSize(Args(1))
	LTalk2_Font_setFamily(Args(2))
	LTalk2_Font_setWeight(Args(3))
	LTalk2_Font_setColor(Args(4))
Return
 
// @param Args(1) フォントサイズ
LTalk2_Font_setSize:
	LTalk2_Font["Size"] = Args(1)
Return
// @param Args(1) フォントファミリー
LTalk2_Font_setFamily:
	LTalk2_Font["Family"] = Args(1)
Return
// @param Args(1) フォントウェイト
LTalk2_Font_setWeight:
	Switch Args(1)
	Case "Regular" "regular"
		LTalk2_Font["Weight"] = "00"
	Case "Bold" "bold"
		// Boldフラグを書き換え
		Replace(LTalk2_Font["Weight"], "0", 1, 1)
	Case "Italic" "italic"
		// Italicフラグを書き換え
		Replace(LTalk2_Font["Weight"], "0", 2, 1)
	EndSw
Return
// @param Args(1) フォントカラー
LTalk2_Font_setColor:
	Local _elem = LTalk2_Font_ConvertColor(Args(1))
	LTalk2_Font["Color"] = _elem
Return
 
LTalk2_Font_ConvertColor:
	Local elem
	Switch Args(1)
	Case "Red" "red" "RED"
		elem = "#ff0000"
	Case "Blue" "blue" "BLUE"
		elem = "#0000ff"
	Case "Yellow" "yellow" "YELLOW"
		elem = "#ffff00"
	Case "Green" "green" "GREEN"
		elem = "#008000"
	Case "Purple" "purple" "PURPLE"
		elem = "#800080"
	Case "Gray" "gray" "GRAY"
		elem = "#808080"
	Case "Silver" "silver" "SILVER"
		elem = "#c0c0c0"
	Case "White" "white" "WHITE"
		elem = "#ffffff"
	Case "Black" "black" "BLACK"
		elem = "#000000"
	Case "Lime" "lime" "LIME"
		elem = "#00ff00"
	Case "Aqua" "aqua" "AQUA"
		elem = "#00ffff"
	Case "Fuchsia" "fuchsia" "FUCHSIA"
		elem = "#ff00ff"
	Case "Maroon" "maroon" "MAROON"
		elem = "#800000"
	Case "Olive" "olive" "OLIVE"
		elem = "#808000"
	Case "Teal" "teal" "TEAL"
		elem = "#008080"
	Case "Navy" "navy" "NAVY"
		elem = "#000080"
	Case Else
		If Left(Args(1), 3) = "RGB" Then
			elem = Eval(elem)
		Else
			elem = Args(1)
		Endif
	EndSw
 
Return elem