Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Mapa de caracteres ASCII + Símbolo
- (
- var q,size = 20,font_general = ["Helvetica", 20];
- w = Window("Mapa de caracteres", Rect(20, Window.screenBounds.height - 500, 600, 400),scroll:true).front.alwaysOnTop_(true);
- StaticText.new(w, Rect(5, 0, 30, 20)).string_("Font").align_(\right);
- m = PopUpMenu(w.view, Rect(40, 0, 250, 20));
- m.items = Font.availableFonts;
- StaticText.new(w, Rect(290, 0, 28, 20)).string_("Size").align_(\right);
- y = PopUpMenu(w.view, Rect(322, 0, 50, 20));
- y.items = Array.series(100,20,2);
- StaticText.new(w,Rect(10,30,300,30)).string_("Código ASCII / Símbolo asociado").font_(font_general);
- //Iteraciones para el mapa de caracteres
- q=FlowLayout( w.view.bounds, 10@60, 20@5 );
- w.view.decorator = q;
- 255.do{ |i|
- var t, font = "Helvetica";
- t=i.asAscii.asCompileString;
- StaticText( w.view,(size*3)@(size) ).string_(i).font_(font_general);
- StaticText( w.view,(size*3)@(size*3.5) ).string_(if (t.asString.contains(".asAscii")==true,{""},{(t.asString).replace("$","").replace("[","").replace("]","").replace("\,","").replace("\\","")})).font_(Font(font,size)).align_(\center);
- q.nextLine;
- };
- //Si le cambio al tipo de letra
- y.action = {
- var nuevafont;
- nuevafont = Font(m.items[m.value],y.items[y.value].asInteger);
- 510.do({|i| w.view.children[i+5].remove});
- //q.remove;
- q.reset;
- 255.do{ |i|
- var t;
- t=i.asAscii.asCompileString;
- StaticText( w.view,((y.items[y.value].asInteger)*3)@(y.items[y.value].asInteger) ).string_(i).font_(font_general);
- StaticText( w.view,((y.items[y.value].asInteger)*3)@((y.items[y.value].asInteger)*3.5) ).string_(if (t.asString.contains(".asAscii")==true,{""},{(t.asString).replace("$","").replace("[","").replace("]","").replace("\,","").replace("\\","")})).font_(nuevafont).align_(\center);
- q.nextLine};
- };
- //Si le cambio el tamaño
- m.action = y.action;
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement