{"id":516,"date":"2008-05-09T14:01:13","date_gmt":"2008-05-09T14:01:13","guid":{"rendered":"http:\/\/6teen.ru\/?p=472"},"modified":"2008-05-09T14:01:13","modified_gmt":"2008-05-09T14:01:13","slug":"7972","status":"publish","type":"post","link":"http:\/\/pblog.ru\/lab\/?p=516","title":{"rendered":"\u041a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b TFont, TBrush&#8230;"},"content":{"rendered":"<p>\u041a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b TFont, TBrush&#8230;<br \/>\n<!--more--><\/p>\n<pre class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; width:580px; height:320px; overflow:auto\"><div>\u041a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b TFont, TBrush...\n\nprocedure strtofont(str: string; font: tfont);\nfunction fonttostr(font: tfont): string;\n\nprocedure strtobrush(str : string; brush : tbrush);\nfunction brushtostr(brush: tbrush): string;\n\nimplementation\n\nuses sysutils;\n\nfunction firstwordseperator(sep : string;var workstr : string; cut :\nboolean) : string;\nvar counter : word;\nbegin \/\/ \"abcxdef\" -> counter=4\ncounter:=pos(sep,workstr);\nif counter>0\nthen result:=copy(workstr,1,counter-1)\nelse result:=workstr;\n\nif cut then\nbegin\nif counter>0\nthen delete(workstr,1,counter+length(sep)-1)\nelse workstr:='';\nend;\nend;\n\n\nfunction tok(sep: string; var s: string): string;\n\/\/ gives back part of string before the given seperator\n\/\/ and throws away this part and the seperator\nbegin\nresult:=firstwordseperator(sep,s,true);\nend;\n\nprocedure yesno(yes : boolean;var str:string);\nbegin\nif yes\nthen\nstr:=str+'y'\nelse\nstr:=str+'n';\nend;\n\nfunction fonttostr(font: tfont): string;\nbegin\n{encode all attributes of a tfont into a string}\nresult := '';\nresult := result + inttostr(font.color) + ' ';\nresult := result + inttostr(font.height) + ' ';\nresult := result + font.name + ' ';\nresult := result + inttostr(ord(font.pitch)) + ' ';\nresult := result + inttostr(font.pixelsperinch) + ' ';\nresult := result + inttostr(font.size) + ' ';\nyesno(fsbold in font.style,result);\nyesno(fsitalic in font.style,result);\nyesno(fsunderline in font.style,result);\nyesno(fsstrikeout in font.style,result);\nend;\n\nprocedure strtofont(str: string; font: tfont);\nbegin\nif str = '' then exit;\nfont.color := strtoint(tok(' ', str));\nfont.height := strtoint(tok(' ', str));\nfont.name := tok(' ', str);\nfont.pitch := tfontpitch(strtoint(tok(' ', str)));\nfont.pixelsperinch := strtoint(tok(' ', str));\nfont.size := strtoint(tok(' ', str));\nfont.style := [];\nif str[1] = 'y' then font.style := font.style + [fsbold];\nif str[2] = 'y' then font.style := font.style + [fsitalic];\nif str[3] = 'y' then font.style := font.style + [fsunderline];\nif str[4] = 'y' then font.style := font.style + [fsstrikeout];\nend;\n\n\/\/ ##########################################\n\n\nfunction brushtostr(brush: tbrush): string;\nbegin\nresult := '';\nresult := result + inttostr(brush.color) + ' ';\n\ncase brush.style of\nbssolid : result:=result+'1';\nbsclear : result:=result+'2';\nbsbdiagonal : result:=result+'3';\nbsfdiagonal : result:=result+'4';\nbscross : result:=result+'5';\nbsdiagcross : result:=result+'6';\nbshorizontal : result:=result+'7';\nbsvertical : result:=result+'8';\nend;\nend;\n\n\nprocedure strtobrush(str : string; brush : tbrush);\nbegin\nif str = '' then exit;\nbrush.color := strtoint(tok(' ', str));\n\nbrush.style := bssolid;\ncase upcase(str[1]) of \/\/ enumerated like in helppage\n'1' : brush.style := bssolid;\n'2' : brush.style := bsclear;\n'3' : brush.style := bsbdiagonal;\n'4' : brush.style := bsfdiagonal;\n'5' : brush.style := bscross;\n'6' : brush.style := bsdiagcross;\n'7' : brush.style := bshorizontal;\n'8' : brush.style := bsvertical;\nend;\nend;\n<\/div><\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b TFont, TBrush&#8230;<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[427,444],"tags":[1181,1923,1538,1758],"_links":{"self":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/516"}],"collection":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=516"}],"version-history":[{"count":0,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/516\/revisions"}],"wp:attachment":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=516"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}