Selected Font Style
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Selected Font Style
The help suggests that PB only supports Bold and Italic Font Styles. However, it seems PB does support the four common styles used by many TTF and open Fonts:
Regular = 0
Italic = 512
Bold = 256
Bold Italic = 768
It would nice to have the Get/Set/Requester Font functions working in the same way by having all four values as PB constants:
#PB_Font_Regular
#PB_Font_Bold
#PB_Font_Italic
#PB_Font_Bold_Italic
Regular = 0
Italic = 512
Bold = 256
Bold Italic = 768
It would nice to have the Get/Set/Requester Font functions working in the same way by having all four values as PB constants:
#PB_Font_Regular
#PB_Font_Bold
#PB_Font_Italic
#PB_Font_Bold_Italic
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Selected Font Style
It says that flags can be combined, which means you combine Bold and Italic flags to get bold italic. I admit there should be an example of this.The help suggests that PB only supports Bold and Italic Font Styles.
Code: Select all
OpenWindow(0, 200, 200, 512, 384, "", #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget | #PB_Window_SystemMenu)
LoadFont(0, "Monospace", 14, #PB_Font_Italic)
LoadFont(1, "Monospace", 14, #PB_Font_Italic | #PB_Font_Bold)
TextGadget(0, 10, 10, 300, 20, "Monotype Font 1")
TextGadget(1, 10, 40, 300, 20, "Monotype Font 2")
SetGadgetFont(0, FontID(0))
SetGadgetFont(1, FontID(1))
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
common way = basic knowledge ...?
it is the common way to combine flags. look at the window call in your code.
so the question is, where to put an example how to combine flags, in every command that can use it?
it is mentioned somewhere in the help, don't recall now wich command it was.
so the question is now, whether to put a short sentence in every command's paragraph,
or to consider this basic knowledge that belongs into a beginner's tutorial.
so the question is, where to put an example how to combine flags, in every command that can use it?
it is mentioned somewhere in the help, don't recall now wich command it was.
so the question is now, whether to put a short sentence in every command's paragraph,
or to consider this basic knowledge that belongs into a beginner's tutorial.
oh... and have a nice day.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Selected Font Style
Certainly there are ample examples of flags being combined. My point is that PB is effectively out of synch with the information that is delivered. If there are four styles, then there is no harm in having four constants to match - yes you can code around it (by simply defining your own constants), but it would be better if PB was not ambiguous in this case.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
Re: Selected Font Style
sorry, there are TONS of constants that define FLAGS wich are one single bit.
do you think EVERY combination should have it's own constant?
that would mean THOUSANDS of redundant constants, that is ridiculous!
combining BITFLAG constants by 'bitwise or' just is the correct way to go, it's not to the merest some "coding around".
do you think EVERY combination should have it's own constant?

that would mean THOUSANDS of redundant constants, that is ridiculous!
combining BITFLAG constants by 'bitwise or' just is the correct way to go, it's not to the merest some "coding around".
Last edited by Kaeru Gaman on Mon Jan 25, 2010 12:19 am, edited 1 time in total.
oh... and have a nice day.
Re: Selected Font Style
Code: Select all
#PB_Font_Bold
#PB_Font_Italic
#PB_Font_StrikeOut
#PB_Font_Underline

-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Selected Font Style
Hi Kaeru
I don't believe there are thousands of constants specific to font style
. Is there a pair of PB font style constants that can be combined to define the style 'regular'? The point and beauty of standard constants is their simplicity. It is certainly not the most important feature request but I think everyone is entitled to have a view about what "would be nice". It's just one more thing that a dynamic app does not need to worry about.
I don't believe there are thousands of constants specific to font style

IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
Re: Selected Font Style
it's not only about fontstyles, there are thousands of constants that are bitflags defining anything.
take the windows' style flags:
as you can see, three basic bits are set in three, two in five, but the rest are single bitflags.
you need to combine them "manually" if you want them combined.
those are 14 constants each different in at least one bit.
according to your argumentation, we should introduce a special constant for each possible combination.
2^14 are 16384...
do you want 16384 new constants for opening a window?
it would take YEARS just to find that much new names...
... and this is only one more purpose, there are hundred more purposes where single-bit constants are defined.
when you ask it for fontstyles, you could ask it for everything that is flagged via bitflags and has predifined constants.
... now you see, this is what I meant with "ridiculous"...
take the windows' style flags:
Code: Select all
#PB_Window_BorderLess 10000000000000000000000000000000
#PB_Window_Invisible 00010000000000000000000000000000
#PB_Window_Maximize 00000001000000000000000000000000
#PB_Window_MaximizeGadget 00000000110010010000000000000000
#PB_Window_Minimize 00100000000000000000000000000000
#PB_Window_MinimizeGadget 00000000110010100000000000000000
#PB_Window_NoGadgets 00000000000000000000000000001000
#PB_Window_Normal 00000000000000000000000000000000
#PB_Window_ScreenCentered 00000000000000000000000000000001
#PB_Window_SizeGadget 00000000110001000000000000000000
#PB_Window_SystemMenu 00000000110010000000000000000000
#PB_Window_TitleBar 00000000110000000000000000000000
#PB_Window_Tool 00000000000000000000000000000100
#PB_Window_WindowCentered 00000000000000000000000000000010
you need to combine them "manually" if you want them combined.
those are 14 constants each different in at least one bit.
according to your argumentation, we should introduce a special constant for each possible combination.
2^14 are 16384...
do you want 16384 new constants for opening a window?
it would take YEARS just to find that much new names...
... and this is only one more purpose, there are hundred more purposes where single-bit constants are defined.
when you ask it for fontstyles, you could ask it for everything that is flagged via bitflags and has predifined constants.
... now you see, this is what I meant with "ridiculous"...
oh... and have a nice day.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Selected Font Style
Hi Kaeru
Can we agree to disagree? My feature request is only about font styles. There are font styles that you cannot support by combination of the existing PB constants. That is it.
Can we agree to disagree? My feature request is only about font styles. There are font styles that you cannot support by combination of the existing PB constants. That is it.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Selected Font Style
@IdeasVacuum: Kaeru makes a good point that it is easier to combine the constants instead of having one for each possible unique value. You mention only three values, ts-soft mentioned 2 more, plus one not mentioned (#PB_Font_HighQuality). That brings the number of combinations to 31 (we ignore 'Regular' for this computation). That's still a lot of constants. If your goal is simplicity then you would have to deal with looking up the right constant or coming up with a naming convention of putting all the attributes in alphabetical order in the constant name.IdeasVacuum wrote:Hi Kaeru
Can we agree to disagree? My feature request is only about font styles. There are font styles that you cannot support by combination of the existing PB constants. That is it.
In practice it is much simpler to just combine the individual constant using 'bitwise or'. If you use a particular combination enough then create your own constant that combines them.
What were the font styles that were not currently supported?
And yes, I can agree to disagree.

-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Selected Font Style
Hello Demivec
Well, #PB_Font_StrikeOut, #PB_Font_Underline and #PB_Font_HighQuality are not strictly font styles but of course can be combined as required/as available. The four physical font styles are:
Regular
Italic
Bold
Bold Italic
To match that list in PB Constants would raise the font style constant total from two to four.
Well, #PB_Font_StrikeOut, #PB_Font_Underline and #PB_Font_HighQuality are not strictly font styles but of course can be combined as required/as available. The four physical font styles are:
Regular
Italic
Bold
Bold Italic
To match that list in PB Constants would raise the font style constant total from two to four.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
Re: Selected Font Style
since #PB_Font_StrikeOut, #PB_Font_Underline and #PB_Font_HighQuality
are bitflags for exactly the same style flag-'register' as Bold and Italic,
you'll need to put them into new constants if it should make the merest sense.
as Devivec kindly pointed out, this would mean 31 combinations => 26 new constants.
if you say, you only want Bold and Italic combined to one new constant - where exactly is your problem?
where is the difficulty in writing
introducing one little constant and not the other 25 would not mean "being less ambigous",
it would mean creating an inconsistency.
every little status of every single element that could be flagged with one bit has a constant for this bit.
there are no combined constants, in no context.
you did not answer this question:
but I see no Flag missing so far....
PS:
maybe you are puzzled by the decimal numbers.
when you debug it binary, you'll see the single bits.
see? each style has a bit, all five style could be arbitryrily combined.
also, when you look at a text editor like Word, you have TWO buttons, one for Bold and one for Italic, that can be pressed or not, each for each.
there is no third "IB" button...
are bitflags for exactly the same style flag-'register' as Bold and Italic,
you'll need to put them into new constants if it should make the merest sense.
as Devivec kindly pointed out, this would mean 31 combinations => 26 new constants.
if you say, you only want Bold and Italic combined to one new constant - where exactly is your problem?
where is the difficulty in writing
Code: Select all
#PB_Font_Italic | #PB_Font_Bold
it would mean creating an inconsistency.
every little status of every single element that could be flagged with one bit has a constant for this bit.
there are no combined constants, in no context.
you did not answer this question:
when a flag is missing, ok, it should be implemented.Demivec wrote:What were the font styles that were not currently supported?
but I see no Flag missing so far....
PS:
maybe you are puzzled by the decimal numbers.
when you debug it binary, you'll see the single bits.
Code: Select all
#PB_Font_Underline 0000000000000100
#PB_Font_StrikeOut 0000000000001000
#PB_Font_HighQuality 0000000000010000
#PB_Font_Bold 0000000100000000
#PB_Font_Italic 0000001000000000
also, when you look at a text editor like Word, you have TWO buttons, one for Bold and one for Italic, that can be pressed or not, each for each.
there is no third "IB" button...
oh... and have a nice day.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Selected Font Style
Hi Kaeru
Well, there isn't a font style that is not supported, as I mentioned in the original post. However, there is no constant for the 'Regular' font style and to my mind if you then add it, 3 of the 4 styles are then an individual constant, it is logical to also have the fourth (Bold_Italic). I never met anyone that could be puzzled by a bunch of decimal numbers
There are exceptions to every rule, so it is down to whether one thinks my suggestion is logical/helpful or not. It is natural that those who dislike an idea are more vociferous. If people don't find any merit in it, that's fine. I use my own constants in this case, it suits my coding style.
There are old pilots and there are bold pilots - but there are no old bold pilots!
Well, there isn't a font style that is not supported, as I mentioned in the original post. However, there is no constant for the 'Regular' font style and to my mind if you then add it, 3 of the 4 styles are then an individual constant, it is logical to also have the fourth (Bold_Italic). I never met anyone that could be puzzled by a bunch of decimal numbers

There are old pilots and there are bold pilots - but there are no old bold pilots!
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
Re: Selected Font Style
> There are old pilots and there are bold pilots - but there are no old bold pilots!
well, there are very few
*
you keep saying "the fourth constant". ... poor twenty-five orphants you don't mention...
see, I just wanted to show you why your request is redundant.
you should not be too disappointed if it is not taken into the least account.
if it was introduced, I would not mock the inconsistency, I would just shrug and move on.
*<offtopic>
Radio: "I'm f*king bored!"
Tower: "Aircraft last transmitting. Identify yourself immediately!"
Radio: "I said I'm f*king bored, not f*king stupid."
</offtopic>
well, there are very few

you keep saying "the fourth constant". ... poor twenty-five orphants you don't mention...
see, I just wanted to show you why your request is redundant.
you should not be too disappointed if it is not taken into the least account.
if it was introduced, I would not mock the inconsistency, I would just shrug and move on.
*<offtopic>
Radio: "I'm f*king bored!"
Tower: "Aircraft last transmitting. Identify yourself immediately!"
Radio: "I said I'm f*king bored, not f*king stupid."
</offtopic>
oh... and have a nice day.