Xojo Conferences
MBSOct2019CologneDE

stringwidth accuracy (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Regex Help - subexpressioncount
Next thread: New JavaScript engine


When is CompareRows done?   -   Hadley, Joshua
  stringwidth accuracy   -   Jeff O'Brien
   Re: stringwidth accuracy   -   Joseph J. Strout
    Re: stringwidth accuracy   -   Jeff O'Brien
     Re: stringwidth accuracy   -   Joseph J. Strout
   Re: stringwidth accuracy   -   Stephan Stoske
    Re: stringwidth accuracy   -   Jeff O'Brien
     Re: stringwidth accuracy   -   Stephan Stoske
   Re: stringwidth accuracy   -   Ian Devaney
    Re: stringwidth accuracy   -   Frank Bitterlich
    Re:stringwidth accuracy   -   Jules.Jacquot

stringwidth accuracy
Date: 29.08.02 16:00 (Thu, 29 Aug 2002 11:00:41 -0400)
From: Jeff O'Brien
how can i increase the accuracy of stringwidth?
and positioning in general when doing g.drawstring?

jeff

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: stringwidth accuracy
Date: 29.08.02 16:06 (Thu, 29 Aug 2002 08:06:08 -0700)
From: Joseph J. Strout
At 11:00 AM -0400 8/29/02, Jeff O'Brien wrote:

>how can i increase the accuracy of stringwidth?

In what way do you find it inaccurate?

>and positioning in general when doing g.drawstring?

What do you mean -- you want subpixel precision, or what?

Cheers,
- Joe

Re: stringwidth accuracy
Date: 29.08.02 23:42 (Thu, 29 Aug 2002 18:42:43 -0400)
From: Jeff O'Brien

On Thursday, August 29, 2002, at 11:06 AM, Joseph J. Strout wrote:

> At 11:00 AM -0400 8/29/02, Jeff O'Brien wrote:
>
>> how can i increase the accuracy of stringwidth?
>
> In what way do you find it inaccurate?
>
>> and positioning in general when doing g.drawstring?
>
> What do you mean -- you want subpixel precision, or what?

i'm trying to write my own right aligned draw string method and it is
working but the accuracy on the right edge is off a little
>
> Cheers,
> - Joe
>
> --
> ,------------------------------------------------------------------.
> | Joseph J. Strout REAL Software, Inc. |
> | <email address removed> http://www.realsoftware.com |
> `------------------------------------------------------------------'
>
> ---
> Subscribe to the digest:
> <mailto:<email address removed>>
> Unsubscribe:
> <mailto:<email address removed>>

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: stringwidth accuracy
Date: 30.08.02 00:01 (Thu, 29 Aug 2002 16:01:28 -0700)
From: Joseph J. Strout
At 6:42 PM -0400 8/29/02, Jeff O'Brien wrote:

>i'm trying to write my own right aligned draw string method and it
>is working but the accuracy on the right edge is off a little

That could be just because CoreGraphics doesn't consider certain
parts of the string to be part of the string, when it comes to
measuring the width. That is, little swashes and such are *supposed*
to dangle off the right side of the line.

HTH,
- Joe

Re: stringwidth accuracy
Date: 29.08.02 16:22 (Thu, 29 Aug 2002 17:22:31 +0200)
From: Stephan Stoske

> how can i increase the accuracy of stringwidth?
> and positioning in general when doing g.drawstring?

The normal resolution is one pixel.
To get more, you must oversampling.

Draw in background with scaling up two or four times.
And scale it down before showing.
So you can get a subpixel precision of 0.5 or 0.25 pixels.
Its also a good way to make things antialiased.

Because the filter is simple, scaling down with drawpicture
will not produce high quality, but its good enough for most cases.

Greetings, Stephan

-------------------------------------------------------------------------
stoske & bertling - visuelle kommunikation
lohmühler berg 30 - 42553 velbert - fon 02053/504464 - fax 02053/923630
<email address removed> - www.stoske-bertling.de - ftp.stoske-bertling.de

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: stringwidth accuracy
Date: 29.08.02 23:44 (Thu, 29 Aug 2002 18:44:35 -0400)
From: Jeff O'Brien

On Thursday, August 29, 2002, at 11:22 AM, Stephan Stoske wrote:

>
>> how can i increase the accuracy of stringwidth?
>> and positioning in general when doing g.drawstring?
>
> The normal resolution is one pixel.
> To get more, you must oversampling.
>
> Draw in background with scaling up two or four times.
> And scale it down before showing.

how do you do this?
I'm really only using the graphics.drawstring to do right aligned text.

> So you can get a subpixel precision of 0.5 or 0.25 pixels.
> Its also a good way to make things antialiased.
>
> Because the filter is simple, scaling down with drawpicture
> will not produce high quality, but its good enough for most cases.
>
> Greetings, Stephan
>
> -----------------------------------------------------------------------
> --
> stoske & bertling - visuelle kommunikation
> lohmühler berg 30 - 42553 velbert - fon 02053/504464 - fax 02053/923630
> <email address removed> - www.stoske-bertling.de -
> ftp.stoske-bertling.de
>
> ---
> Subscribe to the digest:
> <mailto:<email address removed>>
> Unsubscribe:
> <mailto:<email address removed>>

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: stringwidth accuracy
Date: 30.08.02 00:24 (Fri, 30 Aug 2002 01:24:52 +0200)
From: Stephan Stoske
Hi,

> how do you do this?
> I'm really only using the graphics.drawstring to do right aligned text.

The graphics can be a separate buffer (picture) with other size, i.e. two
times bigger.
Double all parameters while drawing your strings or other graphics and then
draw the buffer downscaled into your graphics. On this way the pixel
resolution
is 0.5 Pixel, and a 12 point text will draw as 24 point in the buffer. So
the
quality of the text and the spacings are much better.

But, sorry, i see thats the wrong direction for your problem.

Greetings, Stephan

-------------------------------------------------------------------------
stoske & bertling - visuelle kommunikation
lohmühler berg 30 - 42553 velbert - fon 02053/504464 - fax 02053/923630
<email address removed> - www.stoske-bertling.de - ftp.stoske-bertling.de

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: stringwidth accuracy
Date: 29.08.02 21:46 (Thu, 29 Aug 2002 21:46:18 +0100)
From: Ian Devaney

There is also a pretty longstanding bug where - if a string contains lots of
letters and not so many spaces - the calculation of its width/height/wrap
etc. is completely wrong.

Cheers,

Ian.

On 29/08/2002 06:37 pm, "REALbasic Network Users Group"
<<email address removed>> wrote:

> Subject: Re: stringwidth accuracy
> From: "Joseph J. Strout" <<email address removed>>
> Date: Thu, 29 Aug 2002 08:06:08 -0700
>
> At 11:00 AM -0400 8/29/02, Jeff O'Brien wrote:
>
>> how can i increase the accuracy of stringwidth?
>
> In what way do you find it inaccurate?
>
>> and positioning in general when doing g.drawstring?
>
> What do you mean -- you want subpixel precision, or what?
>
> Cheers,
> - Joe
>
> --
> ,------------------------------------------------------------------.
> | Joseph J. Strout REAL Software, Inc. |
> | <email address removed> http://www.realsoftware.com |
> `------------------------------------------------------------------'

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: stringwidth accuracy
Date: 30.08.02 11:24 (Fri, 30 Aug 2002 12:24:21 +0200)
From: Frank Bitterlich
I don't know if it's really a bug - I have observed this when a string
has words that are simply longer than the wrap width. Unless QuickDraw
can hyphenate words automatically, I think we can't blame it.

Cheers,
Frank+++

Ian Devaney wrote:
>
> There is also a pretty longstanding bug where - if a string contains lots of
> letters and not so many spaces - the calculation of its width/height/wrap
> etc. is completely wrong.

Re:stringwidth accuracy
Date: 30.08.02 17:41 (Fri, 30 Aug 2002 18:41:40 +0200)
From: Jules.Jacquot

>On Thursday, August 29, 2002, at 11:06 AM, Joseph J. Strout wrote:
>
> > At 11:00 AM -0400 8/29/02, Jeff O'Brien wrote:
>>
>>> how can i increase the accuracy of stringwidth?
>>
>> In what way do you find it inaccurate?
>>
>>> and positioning in general when doing g.drawstring?
>>
>> What do you mean -- you want subpixel precision, or what?

Try this method below :

ecðrmat(somme,"#.00")
fc=gh.stringWidth(ec)
gh.drawstring ec,305-fc,ligne

somme is your value

gh is graphics

305 is the right aligment ( pixel)

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>