{"id":698,"date":"2008-05-22T04:21:01","date_gmt":"2008-05-22T04:21:01","guid":{"rendered":"http:\/\/6teen.ru\/?p=469"},"modified":"2008-05-22T04:21:01","modified_gmt":"2008-05-22T04:21:01","slug":"5812","status":"publish","type":"post","link":"http:\/\/pblog.ru\/lab\/?p=698","title":{"rendered":"\u041a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 ini \u0444\u0430\u0439\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 TFont"},"content":{"rendered":"<p>\u041a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 ini \u0444\u0430\u0439\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 TFont<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\u0438\u0442\u044c \u0432 ini \u0444\u0430\u0439\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 TFont\n\nuses\nIniFiles;\n\nprocedure TForm1.Button1Click(Sender: TObject);\nvar\nIniFile : TIniFile;\nbegin\nIniFile := TIniFile.Create('myIni.ini');\nwith Edit1.Font do with IniFile do begin\nName    := ReadString ('Font','Name','MS Mans Serif');\nCharset := ReadInteger('Font','Charset',RUSSIAN_CHARSET);\nColor   := ReadInteger('Font','Color', clWindowText);\nHeight  := ReadInteger('Font','Height',-11);\nSize    := ReadInteger('Font','Size',8);\nStyle   := TFontStyles(Byte(ReadInteger('Font','Style',0)));\nend;\nIniFile.Free;\nend;\n\nprocedure TForm1.Button2Click(Sender: TObject);\nvar\nIniFile : TIniFile;\nbegin\nIniFile := TIniFile.Create('myIni.ini');\nwith Edit1.Font do with IniFile do begin;\nWriteString ('Font','Name', Name);\nWriteInteger('Font','Charset', Charset);\nWriteInteger('Font','Color', Color);\nWriteInteger('Font','Height', Height);\nWriteInteger('Font','Size', Size);\nWriteInteger('Font','Style',Byte(Style));\nend;\nIniFile.Free;\nend;\n\n*****************************************************\n\n\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0448\u0440\u0438\u0444\u0442\u0430 \u0432 \u0444\u0430\u0439\u043b\u0435\n\nfunction fonttostr(font: tfont): string;\nprocedure yes(var str:string);\nbegin\nstr := str + 'y';\nend;\nprocedure no(var str:string);\nbegin\nstr := str + 'n';\nend;\nbegin\n{\u043a\u043e\u0434\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b tfont \u0432 \u0441\u0442\u0440\u043e\u043a\u0443}\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) + '|';\nif fsbold in font.style then yes(result) else no(result);\nif fsitalic in font.style then yes(result) else no(result);\nif fsunderline in font.style then yes(result) else no(result);\nif fsstrikeout in font.style then yes(result) else no(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[0] = 'y' then font.style := font.style + [fsbold];\nif str[1] = 'y' then font.style := font.style + [fsitalic];\nif str[2] = 'y' then font.style := font.style + [fsunderline];\nif str[3] = 'y' then font.style := font.style + [fsstrikeout];\nend;\n\nfunction tok(sep: string; var s: string): string;\nfunction isoneof(c, s: string): boolean;\nvar\nitmp: integer;\nbegin\nresult := false;\nfor itmp := 1 to length(s) do\nbegin\nif c = copy(s, itmp, 1) then\nbegin\nresult := true;\nexit;\nend;\nend;\nend;\nvar\nc, t: string;\nbegin\nif s = '' then\nbegin\nresult := s;\nexit;\nend;\nc := copy(s, 1, 1);\nwhile isoneof(c, sep) do\nbegin\ns := copy(s, 2, length(s) - 1);\nc := copy(s, 1, 1);\nend;\nt := '';\nwhile (not isoneof(c, sep)) and (s <> '') do\nbegin\nt := t + c;\ns := copy(s, 2, length(s)-1);\nc := copy(s, 1, 1);\nend;\nresult := t;\nend;\n<\/div><\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 ini \u0444\u0430\u0439\u043b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 TFont<\/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":[1094,82,262,1756,344],"_links":{"self":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/698"}],"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=698"}],"version-history":[{"count":0,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/698\/revisions"}],"wp:attachment":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=698"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}