Control branches based on fonts

Source: Internet
Author: User

Function heightofbyte (VAR Font: tfont): extended;
VaR
Con: extended;
Num: integer;
Begin
If font. size> = 3 then
Begin
Num: = (font. Size-1) Div 10;
Result: = 6.0743 + 1.32284 * (font. Size-3) + num * 0.0945;
End
Else
Begin
If font. size = 2 then
Begin
Result: = 5.7969;
End
Else
Begin
Result: = 3.3071;
End;
End;
End;

Function widthofbyte (VAR Font: tfont): extended;
VaR
Con: extended;
Num: integer;
Begin
Num: = 0;
If font. size> = 2 then
Num: = (font. Size-2) Div 6 + 1;
Result: = 0.0378 + 0.65252 * font. Size + num * 0.1512;
If font. Style <fsbold> then
Result: = Result + 0.0756;
End;

Function getlength (VAR Font: tfont; width: Extended): integer;
VaR
BW: extended;
Begin
BW: = widthofbyte (font );
Result: = 0;
While result * BW <width do
Begin
Result: = Result + 1;
End;
End;

Procedure disposestring (VAR pstring: string; Plen: integer; WS: twidestrings );
VaR
Data, curdata: string;
Varxx: variant;
Len, len_y: integer;
BW: extended;
Begin
WS. Clear ();
Data: = pstring;
Varxx. bstrval: = data;
Len: = length (varxx );
While Plen <Len do
Begin
Len_y: = 1;
While len_y <Plen do
Begin
If ord (data [len_y])> 127 then
Len_y: = len_y + 1;
Len_y: = len_y + 1;
End;
Curdata: = copy (data, 1, len_y );
WS. Add (curdata );
Data: = copy (data, len_y + 1, Len-Len_Y );
Len: = Len-Len_Y;
End;
WS. Add (data );
End;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.