Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Part of the string - in Bold
Message
 
 
À
10/01/2001 11:53:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00461366
Message ID:
00461712
Vues:
58
Hi Nuno,

>Nadya, i think i have a problem identic ...
> I'm designing a Report too, and as a good "Report Designer" it as to give the possibility of the user say the font name and size.
>
> The PROBLEM is in the weight and width, is diferent from one font to another.
> I ALLMOST solve the all problem, but is gives a little diferent in some font's.
>
>#define g_RptConverteFACTOR           104.166666666667
>
>** Text Width **
>lnSize = TXTWIDTH(DisplayText,FontName, FontSize) * FONTMETRIC(6, FontName, FontSize)
>lnSize = Round(lnSize * g_RptConverteFACTOR, 3)
>
>** Text height **
>lnSize = FONTMETRIC(1, FontName, FontSize)
>lnSize = Round(lnSize * g_RptConverteFACTOR, 3)
>
>With this two "Formulas" i can get the size (height/width) to report of any field in any font and size.
>
>.         Font |  Form  |  Report    | My Formula
>.--------------+--------+------------+-------------
>.Arial      4  |    8   |   625.000  |   625.000
>.           9  |   17   |  1562.500  |  1562.500
>.          18  |   29   |  2916.667  |  2916.667
>.          24  |   38   |  3854.167  |  3750.000  ????
>
What is Font/Form here?

What is the Factor?

The problem is, that txtWidth calculates based on the average character width of a specified font . This leads to problems, especially for big fonts, because different letters has different width, obviously.

In my Report I tried Tahoma 9, Arial 9, Times New Roman 9. In each case, it looks like "," which I added after bold portion (Buyer) too close (even overlap) the last letter. Therefore I added one additional space. Now there is a little space (less, than normal space) between comma and last letter of Buyer, but I think, it's a minor problem. May be I have to use ceiling function, but I believe, I tried with the same undesired result. Well, I guess, there is nothing we can do about it, unless messing with some API functions to calculate text width precisely, based on each letter actual width.

Or did I misunderstand you and your problem lies in something else?


>See the ??? (MyFormula), there is the "matematic error".
>If this help in your report, and you can help me solving the little problem say ok ?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform