mIRC Home    About    Download    Register    News    Help

Print Thread
#200121 28/05/08 02:58 PM
X
Xalphire
Xalphire
X
What is the purpose of the first parameter of $height?

It doesn't seem to matter what is put there it always returns the same height for given font/size.

#200137 28/05/08 11:45 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
It is there so that $height and $width take the same first 3 parameters so there isn't any confusion.

Riamus2 #200144 29/05/08 03:03 AM
X
Xalphire
Xalphire
X
Are you sure about that?
Did you ask Khaled or are you just taking a stab at it?

Everyone I've asked about it seemed more confused by it's existence & uselessness... (Most assumed it was to tell the height difference between tall and short characters)

Also it teaches bad scripting habits... mirc has to parse useless identifiers and variables when people assume they have to use their full text there.

And there are many identifiers that are similar to each other that omit useless parameters of their counterparts (presumably for this reason) [See token identifiers].

#200155 29/05/08 11:54 AM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
Tokens still require text as a parameter. And, it was a guess, but is probably a good one. It is much easier to script or program if you don't have similar identifier/commands that use completely different syntax, imo.

Riamus2 #200180 29/05/08 04:05 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Syntax: $height(text,font,size)

When writting to a window using draw commands pixels come into play now depending on the actual font its pixel maps could be drawn differently from a simple ARIAL font to a Custom font such has Chicken Scratch. If you go to a simple paint program and different between the font #'s and the font themselves youll see that some can be read and some can hardly be read and some are different sizes when talking about height. Now the Text position of this field ask to put any data you want (treated has plain text) as if you were doing this in a paint program with font editor, then pixel wise.. it ask for the font name, and the size of the font so you can know the Pixels CEILING height or length vertical known has Y, remember your X,Y's? AND NO they are chromosomes... lol

Font, no explanation needed use any font you want to determine it's """PIXEL""" size

Last but not lease it's size (this becomes a variable) using $height(text,arial,14) has the same height properties has $height(text,arial,13) has pixel wise talking it has a different that is too minimal for it to be smaller then box 14 or larger then 13 now if you go to size 15 the value changes. Now on custom font's value 14 arial might be different size on chicken scratch 14.

So long story short the TEXT value is for the program (mirc) to realize it has to test something, just like when you use a PAINT program you wont know the SIZE till you enter data into the shiny little box.

Lpfix5 #200186 29/05/08 06:15 PM
X
Xalphire
Xalphire
X
*sigh*
Thanx for trying but I already knew what $height is used for...
It's just that the first parameter doesn't matter, it always gives the same ceiling height for every character of any particular font/size... I'm not saying for every font of the same size... for example...

$height(aaa,Arial,14) returns the same value as $height(AAA,Arial,14)
even though the height of the characters are different the output is the same... so what exactly is mirc testing in the text parameter?

#200189 29/05/08 06:42 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
As I said its testing the PIXEL size barrier. even though its capitalized or not a FONT pixel system has a static size for cap or non cap what mirc is testing is the cap of it's size.

Search up Pixel Size on google or some other string im sure youll find what I mean,

Ill try again to explain it a tad better, when you write something in a font size the size becomes the barrier for that text weather it be 16 pixels (14p text) 1 pixel bottom 1 pixel top space.

If you ever designed a banner for a website you might learn more about pixels this way

Lpfix5 #200194 29/05/08 07:00 PM
X
Xalphire
Xalphire
X
But if fonts have a static pixel size then what is the point of the text parameter? That's my question... There's no point in putting a text string there if all characters have the same pixel height.

#200197 29/05/08 07:15 PM
Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
As far as I can tell there's no real reason. It's probably for parity with $width() as Riamus2 said. Or it might be for future-proofing the identifier - for instance it could support multiple lines if /drawtext ever does (although right now neither does).

#200201 29/05/08 07:38 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Its like programming C++ you need to have a variable to analyze the command, you do need any text doesnt matter to be there. the text performs like this

string (eval(font)) (eval(size)) end result Fontname:fontsize:(testing of(string))

without having a string it can't evaluate the font name/size has the font data itself doesnt exist if no string is attached.

so again the initial text going through the string is being tested AS this font with this size.

im almost 100% khaled wrote it the same way from scratch where $height acts as a break down like this (non coding way)

PARAMETER
;need font name
ARIAL
;need font size
14
;end result
PARAMETER is being evaluated for it's height from size

so again the end result is where DATA NEEDS to be entered (the first string IS NEEDED, because it will be needed in the final result has the system goes through processing


Lpfix5 #200205 29/05/08 07:57 PM
X
Xalphire
Xalphire
X
Your not getting the whole point... mIRC could add a single character to test internally since all characters are the same height... I thought that would have been obvious which is why I didn't say that part.. so still it remains that asking for external text input is pointless... But I guess the answer is that there is no reason... at this time... thx im done bye

#200209 29/05/08 08:33 PM
Joined: Dec 2002
Posts: 3,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
My *guess* would be that $height uses the same API call as $width to retrieve the metrics. If so, Khaled *could* choose to use a dummy character, but there's no real reason to, especially as there's a remote possibility of that changing the results.

Collective #200236 30/05/08 01:09 PM
Joined: Aug 2005
Posts: 1,052
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
BINGO! he said it that's what I was trying to say a simple DUMMY Character, which is used and converted into the FONT mentioned and TEXT size then it is measured for height

It isnt pointless, its there for data to be tested in the end result

DATA gets converted into this FONT and Size then a calculation happens

THE Original input is useless but then gets converted into the font/size mentioned then for the end result test it becomes the OUTPUT of height

#200246 30/05/08 07:39 PM
Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
Not every character has the same height, technically speaking, though im not sure if the algorithm mirc uses cares about that. It could at some point in the future. It might have in the past.

In any case, there is much to be said about consistency of parameters, and keeping it consistent with $width is as valid a reason as any.


Link Copied to Clipboard