From 458fbdac08ee0dad13d8fc44616ec5d830b1f597 Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Tue, 31 Jul 2007 01:37:17 +0200 Subject: [PATCH] Add symbol-set selection to shogi themes. --- data/themes/pieces/ShogiSVG-TTF/theme.desktop | 2 +- data/themes/pieces/ShogiSVG-TTF/theme.lua | 27 ++++++++++++++++++---- .../pieces/ShogiSVG/{ => default}/bishop.svg | 0 .../pieces/ShogiSVG/{ => default}/example.svg | 0 data/themes/pieces/ShogiSVG/{ => default}/gold.svg | 0 .../themes/pieces/ShogiSVG/{ => default}/horse.svg | 0 data/themes/pieces/ShogiSVG/{ => default}/king.svg | 0 .../themes/pieces/ShogiSVG/{ => default}/lance.svg | 0 .../pieces/ShogiSVG/{ => default}/nude_tile.svg | 0 data/themes/pieces/ShogiSVG/{ => default}/pawn.svg | 0 .../pieces/ShogiSVG/{ => default}/pbishop.svg | 0 .../pieces/ShogiSVG/{ => default}/phorse.svg | 0 .../pieces/ShogiSVG/{ => default}/plance.svg | 0 .../themes/pieces/ShogiSVG/{ => default}/ppawn.svg | 0 .../themes/pieces/ShogiSVG/{ => default}/prook.svg | 0 .../pieces/ShogiSVG/{ => default}/psilver.svg | 0 data/themes/pieces/ShogiSVG/{ => default}/rook.svg | 0 .../pieces/ShogiSVG/{ => default}/silver.svg | 0 data/themes/pieces/ShogiSVG/{ => default}/tile.svg | 0 data/themes/pieces/ShogiSVG/theme.lua | 21 +++++++++++++++-- data/themes/pieces/ShogiTTF/theme.lua | 20 +++++++++++----- 21 files changed, 56 insertions(+), 14 deletions(-) rename data/themes/pieces/ShogiSVG/{ => default}/bishop.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/example.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/gold.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/horse.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/king.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/lance.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/nude_tile.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/pawn.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/pbishop.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/phorse.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/plance.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/ppawn.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/prook.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/psilver.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/rook.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/silver.svg (100%) rename data/themes/pieces/ShogiSVG/{ => default}/tile.svg (100%) diff --git a/data/themes/pieces/ShogiSVG-TTF/theme.desktop b/data/themes/pieces/ShogiSVG-TTF/theme.desktop index df1b885..f48c8ec 100644 --- a/data/themes/pieces/ShogiSVG-TTF/theme.desktop +++ b/data/themes/pieces/ShogiSVG-TTF/theme.desktop @@ -2,6 +2,6 @@ Encoding=UTF-8 Name=Shogi SVG/TTF Type=Application -Comment=Shogi TTF theme from SVG files,| created with potrace from ??? +Comment=Shogi TTF theme from SVG files X-Tagua-ThemeType=Pieces X-Tagua-Variants=Chess,Shogi[default] diff --git a/data/themes/pieces/ShogiSVG-TTF/theme.lua b/data/themes/pieces/ShogiSVG-TTF/theme.lua index 9d77180..8ad13e3 100644 --- a/data/themes/pieces/ShogiSVG-TTF/theme.lua +++ b/data/themes/pieces/ShogiSVG-TTF/theme.lua @@ -7,16 +7,33 @@ shadow_offset_x=6 shadow_offset_y=4 shadow_grow=5 +fontnames = {"Potraced from ???", "Potraced from shogi.net"} +fontlist = {"Shogi.ttf", "Shogi2.ttf"} + theme.options = OptList { - BoolOpt("moves_overlay", "Moves overlay", true) + BoolOpt("moves_overlay", "Moves overlay", true), + SelectOpt("symbols", "Symbol set", BoolOptList { + BoolOpt("use_predefined", "Predefined", true, OptList { + ComboOpt("font", "Symbol set", fontnames) + }), + BoolOpt("use_custom", "Custom font", false, OptList { + UrlOpt("file", "SVG glyph directory", "Shogi.ttf") + }), +-- BoolOpt("use_system", "System font", false, OptList { +-- FontOpt("font", "System font", Font("Arial", true, true)) +-- }), + }) } -font="Shogi.ttf" - function addChar(char, promoted) return function(i, size) - i:draw_glyph(Rect(0,0,size,size), "Shogi.ttf", char, - promoted and "#d00000" or "#004000", + i:draw_glyph(Rect(0,0,size,size), + theme.options.symbols.options.use_predefined.value + and fontlist[theme.options.symbols.options.use_predefined.sub_options.font.selected+1] + or theme.options.symbols.options.use_custom.value + and theme.options.symbols.options.use_custom.sub_options.file.value + or theme.options.symbols.options.use_system.sub_options.font.selected, + char, promoted and "#d00000" or "#004000", "#fff3c8", 4, false) return i end diff --git a/data/themes/pieces/ShogiSVG/bishop.svg b/data/themes/pieces/ShogiSVG/default/bishop.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/bishop.svg rename to data/themes/pieces/ShogiSVG/default/bishop.svg diff --git a/data/themes/pieces/ShogiSVG/example.svg b/data/themes/pieces/ShogiSVG/default/example.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/example.svg rename to data/themes/pieces/ShogiSVG/default/example.svg diff --git a/data/themes/pieces/ShogiSVG/gold.svg b/data/themes/pieces/ShogiSVG/default/gold.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/gold.svg rename to data/themes/pieces/ShogiSVG/default/gold.svg diff --git a/data/themes/pieces/ShogiSVG/horse.svg b/data/themes/pieces/ShogiSVG/default/horse.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/horse.svg rename to data/themes/pieces/ShogiSVG/default/horse.svg diff --git a/data/themes/pieces/ShogiSVG/king.svg b/data/themes/pieces/ShogiSVG/default/king.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/king.svg rename to data/themes/pieces/ShogiSVG/default/king.svg diff --git a/data/themes/pieces/ShogiSVG/lance.svg b/data/themes/pieces/ShogiSVG/default/lance.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/lance.svg rename to data/themes/pieces/ShogiSVG/default/lance.svg diff --git a/data/themes/pieces/ShogiSVG/nude_tile.svg b/data/themes/pieces/ShogiSVG/default/nude_tile.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/nude_tile.svg rename to data/themes/pieces/ShogiSVG/default/nude_tile.svg diff --git a/data/themes/pieces/ShogiSVG/pawn.svg b/data/themes/pieces/ShogiSVG/default/pawn.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/pawn.svg rename to data/themes/pieces/ShogiSVG/default/pawn.svg diff --git a/data/themes/pieces/ShogiSVG/pbishop.svg b/data/themes/pieces/ShogiSVG/default/pbishop.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/pbishop.svg rename to data/themes/pieces/ShogiSVG/default/pbishop.svg diff --git a/data/themes/pieces/ShogiSVG/phorse.svg b/data/themes/pieces/ShogiSVG/default/phorse.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/phorse.svg rename to data/themes/pieces/ShogiSVG/default/phorse.svg diff --git a/data/themes/pieces/ShogiSVG/plance.svg b/data/themes/pieces/ShogiSVG/default/plance.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/plance.svg rename to data/themes/pieces/ShogiSVG/default/plance.svg diff --git a/data/themes/pieces/ShogiSVG/ppawn.svg b/data/themes/pieces/ShogiSVG/default/ppawn.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/ppawn.svg rename to data/themes/pieces/ShogiSVG/default/ppawn.svg diff --git a/data/themes/pieces/ShogiSVG/prook.svg b/data/themes/pieces/ShogiSVG/default/prook.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/prook.svg rename to data/themes/pieces/ShogiSVG/default/prook.svg diff --git a/data/themes/pieces/ShogiSVG/psilver.svg b/data/themes/pieces/ShogiSVG/default/psilver.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/psilver.svg rename to data/themes/pieces/ShogiSVG/default/psilver.svg diff --git a/data/themes/pieces/ShogiSVG/rook.svg b/data/themes/pieces/ShogiSVG/default/rook.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/rook.svg rename to data/themes/pieces/ShogiSVG/default/rook.svg diff --git a/data/themes/pieces/ShogiSVG/silver.svg b/data/themes/pieces/ShogiSVG/default/silver.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/silver.svg rename to data/themes/pieces/ShogiSVG/default/silver.svg diff --git a/data/themes/pieces/ShogiSVG/tile.svg b/data/themes/pieces/ShogiSVG/default/tile.svg similarity index 100% rename from data/themes/pieces/ShogiSVG/tile.svg rename to data/themes/pieces/ShogiSVG/default/tile.svg diff --git a/data/themes/pieces/ShogiSVG/theme.lua b/data/themes/pieces/ShogiSVG/theme.lua index b1077e9..8039ebc 100644 --- a/data/themes/pieces/ShogiSVG/theme.lua +++ b/data/themes/pieces/ShogiSVG/theme.lua @@ -7,13 +7,30 @@ shadow_offset_x=6 shadow_offset_y=4 shadow_grow=5 +fontnames = {"Potraced from ???", "Potraced from shogi.net", "Potraced from daemonshogi"} +fontlist = {"default", "shogi.net", "daemonshogi"} + theme.options = OptList { - BoolOpt("moves_overlay", "Moves overlay", true) + BoolOpt("moves_overlay", "Moves overlay", true), + SelectOpt("symbols", "Symbol set", BoolOptList { + BoolOpt("use_predefined", "Predefined", true, OptList { + ComboOpt("font", "Symbol set", fontnames) + }), + BoolOpt("use_custom", "Custom", false, OptList { + UrlOpt("dir", "SVG glyph directory", "default/") + }), + }) } function addGlyph(file) return function(i, size) - i:draw_svg(Rect(0,0,size,size), file) + local dir + if theme.options.symbols.options.use_predefined.value then + dir = fontlist[theme.options.symbols.options.use_predefined.sub_options.font.selected+1] + else + dir = theme.options.symbols.options.use_custom.sub_options.dir.value + end + i:draw_svg(Rect(0,0,size,size), dir .. '/' .. file) return i end end diff --git a/data/themes/pieces/ShogiTTF/theme.lua b/data/themes/pieces/ShogiTTF/theme.lua index 5e93ee7..3f1a171 100644 --- a/data/themes/pieces/ShogiTTF/theme.lua +++ b/data/themes/pieces/ShogiTTF/theme.lua @@ -9,22 +9,30 @@ shadow_grow=5 theme.options = OptList { BoolOpt("moves_overlay", "Moves overlay", true), - BoolOpt("single_kanji", "Single kanji on tiles", false) + BoolOpt("single_kanji", "Single kanji on tiles", false), + SelectOpt("symbols", "Symbol set", BoolOptList { +-- BoolOpt("use_predefined", "Predefined", true, OptList { +-- ComboOpt("font", "Symbol set", fontnames) +-- }), + BoolOpt("use_custom", "Custom font", false, OptList { + UrlOpt("file", "SVG glyph directory", "../../figurines/ShogiTTF/mikachan.ttf") + }), +-- BoolOpt("use_system", "System font", false, OptList { +-- FontOpt("font", "System font", Font("Arial", true, true)) +-- }), + }) } -font="mikachan.ttf" ---font="Sword.ttf" ---font="epgyobld.ttf" - function addChar(complete, single, promoted) return function(i, size) + font = theme.options.symbols.options.use_custom.sub_options.file.value if theme.options.single_kanji.value then i:draw_glyph(Rect(size*0.2,size*0.25,size*0.6,size*0.6), font, single, promoted and "#d00000" or "#004000", "#fff3c8", 4, false) else --local charsize, margin1, margin2 = 0.45, 0.09, -0.02 -- epgyobld - local charsize, margin1, margin2 = 0.4, 0.12, 0 -- mikachan + local charsize, margin1, margin2 = 0.4, 0.12, 0 i:draw_glyph(Rect(size*(0.5-charsize/2),size*margin1,size*charsize,size*charsize), font, complete[1], promoted and "#d00000" or "#004000", "#fff3c8", 4, false) -- 2.11.4.GIT