familyList is ['Don''t Care','Roman','Swiss','Modern','Script','Decorative'].
lb1 is list_box (?familyList,family,36,7.2,13,6,,,[list_select_event,double_click_event]).
lb2 is list_box (['System','Terminal','Roman','Script','Modern','Helv','Courier','Tms Rmn'],face,36,16.2,13,8,,,[list_select_event,double_click_event]).
button (Print,printIt,4,23).
button (Copy, copy_font,13.5 , 23).
button (Quit, quit_font, 22, 23).
pitchList is [Default, Fixed, Variable].
qualityList is [Default, Draft, Proof].
(* Complicated window are drawn much quicker if they are created without a visible style
and then displayed using SHOW_WINDOW after all screen objects are created. *)
show_window (?w1).
topic makeWidth.
width is get_text (?ed1).
fontList is replace_elements (?fontList,2,?width).
showFont ().
end.
topic makeHeight.
height is get_text (?ed2).
fontList is replace_elements (?fontList,1,?height).
showFont ().
end.
topic bold.
if get_check_box (?cb1)
then bold is 400
else bold is 700.
fontList is replace_elements (?fontList,3,?bold).
showFont ().
end.
topic underline.
if get_check_box (?cb2)
then underline is f
else underline is t.
fontList is replace_elements (?fontList,5,?underline).
showFont ().
end.
topic italic.
if get_check_box (?cb3)
then italic is f
else italic is t.
fontList is replace_elements (?fontList,4,?italic).
showFont ().
end.
topic strikeout.
if get_check_box (?cb4)
then strikeout is f
else strikeout is t.
fontList is replace_elements (?fontList,6,?strikeout).
showFont ().
end.
topic set (item).
if ?item is 'ANSI'
then set is 0
else set is 255.
fontList is replace_elements (?fontList,7,?set).
showFont ().
end.
topic quality (item).
quality is (where (?qualityList,?item) - 1).
fontList is replace_elements (?fontList,8,?quality).
showFont ().
end.
topic pitch (item).
pitch is (where (?pitchList,?item) - 1).
item is ?family + ?pitch.
fontList is replace_elements (?fontList,9,?item).
showFont ().
end.
topic family (item).
family is (where (?familyList,?item) - 1)*16.
item is ?family + ?pitch.
fontList is replace_elements (?fontList,9,?item).
showFont ().
end.
topic face (item).
fontList is replace_elements (?fontList,10,?item).
showFont ().
end.
topic showFont.
CopiedtoClip is f.
delete_font (?fontHandle).
fontHandle is create_font (?fontList).
use_font (?fontHandle).
set_text (?w2,'This is the sample font text.').
end.
topic copy_font.
CopiedtoClip is t.
fontText is concat ('create_font ([', list_to_string (?fontList, ',',,,''''), ']).').
text_to_clipboard (?fontText).
temp is window (,15.71,4.75,60.14,11.62,,[popup,showChildren,siblings,DialogFrame]).
make_modal (?temp).
use_font (system_font).
text ('
The code shown below has been copied to the clipboard:
',?fontText).
use_font (?fontHandle).
button ('Continue',done,26.42,7.875,).
show_window ().
topic done.
close_window (?temp).
end.
end.
topic quit_font.
if not (?CopiedtoClip)
then ask_quit ()
else finish ().
topic ask_quit.
wSave is window (,25.42,12,29.71,9,,[popup,showChildren,siblings,DialogFrame]).
use_font (SYSTEM_FONT).
text ('
Copy the most recent
change to the clipboard ?
').
b1 is button ('Yes',[copy_font,finish],6,6,6).
button ('No', finish ,17,6,6).
show_window (?wSave).
set_focus (?b1).
make_modal (?wSave).
end.
topic finish.
hide_window (?w1).
new_kb ('demo.ckb').
end.
end.
topic Printit.
fontText is concat ('create_font ([', list_to_string (?fontList, ',',,,''''), ']).').