[fpc-pascal] Underscores in numerical literals - grouping
Graeme Geldenhuys
mailinglists at geldenhuys.co.uk
Tue Nov 22 12:14:03 CET 2016
On 2016-11-21 23:59, James Richters wrote:
> I, l, 1, AND | are all distinctly
> different with it as well as 0 and O. I have a REAL pet peeve about
> font's that these characters look identical,
You do realise that not all monospaced fonts are equals. Some monospaced
fonts are terrible for programming source code too. Some monospaced
fonts don't make much [if any] distinction between those tricky
characters either.
Then you get fonts like "Input", which actually allows you to configure
the fonts before you download them. You can choose how you want the 0
(zero), a, l, i etc rendering style to look like.
Go to the following URL and click "Customize your download". You can
then configure various character styles (and even line spacing) before
you download a customised font just for you. The choice is available for
both monospaced and proportional versions of the Input font.
http://input.fontbureau.com/download/
So your "pet peeve" (which I also have) holds no merit in this discussion.
PS:
As for your comment about your son's homework. I've had the exact same
issue at my son's school! I can't believe they (the teachers) can be
so stupid.
> P_Range[1,0]:=0;
> I_Range[1,1]:=0;
> W_Range[2,0]:=0;
> R_Range[2,1]:=1;
I prefer spacing between programming language symbols, even though I
have syntax highlighting enabled too. So I would write the above as:
P_Range[1,0] := 0;
I_Range[1,1] := 0;
W_Range[2,0] := 0;
R_Range[2,1] := 1;
I normally use a monospaced font - Raize font to be exact - which is a
bitmap based font.
But to give you an idea of what the above source code will look like in
other editors. Take my code sample above, replace the spaces with single
TAB (U+0009) characters. This not only reduces the file size, it also
reduces the number of characters any parser needs to process (thus
faster parsing and compiling). :)
See attached screenshots.
text_with_tabs_monospaced_font.png
This is viewed with EditPad Pro, using a monospaced font and the
TAB size was set to be equal to 2 spaces in width. Other editors
text to default TAB width to equals 4 or 8 spaces. Point is, the
text will always align. EditPad Pro doesn't support ET.
text_with_tabs_Input-Sans_proportional_font_and_ET.png
Here I used my experimental Elastic Tabstops enable text editor
with a proportional font (Input Sans). Note that the text is still
perfectly aligned. Also note that even though I use a proportional
font, the 1 (one) and 0 (zero) characters are easily
distinguishable from l, I, L, o and O letters. The 3rd note is
that with ET, the minimum width and padding are defined in pixels,
not [Space] character widths (like most editors do with TAB
widths).
So this just shows that alignment can be achieved with or without
monospaced fonts. Also that not all fonts are created equal. Just like
not all monospaced fonts are appropriate for programming (tricky letters
and numbers). Also not all proportional fonts are created equal - some
are better suited to programming code than others. The "Input Sans" font
is actually very nice for source code.
Regards,
Graeme
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
My public PGP key: http://tinyurl.com/graeme-pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text_with_tabs_monospaced_font.png
Type: image/png
Size: 2216 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20161122/db37570b/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: text_with_tabs_Input-Sans_proportional_font_and_ET.png
Type: image/png
Size: 5075 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20161122/db37570b/attachment-0001.png>
More information about the fpc-pascal
mailing list