A TrueType font in a TTY: Glass_TTY

How do you use a TrueType font in a TTY (not a terminal emulator — you know, like you reach going Ctrl+Alt+F1)? Let’s use:

https://github.com/svofski/glasstty/blob/master/Glass_TTY_VT220.ttf.

Where are the console fonts?

$ find /usr/share -name "*.psf.gz"

Stuff is in /usr/share/consolefonts

Can test one out in the TTY

$ setfont /path/to/file.psf.gz

Yep, the font changes.

The colour — for Glass_TTY we would like amber on black.

This is how: https://www.datafix.com.au/BASHing/2020-02-19.html

So their example is:

$ printf %b '\e]P0f0fef0' '\e]P7000000'
$ clear

Amber is FFBF00 and black is 000000, so:

$ printf %b '\e]P0000000' '\e]P7ffbf00'
$ clear

Yep, that works.

Now, we need a PSF file of the Glass_TTY.

$ sudo apt install fontforge

See https://fontforge.org/docs/tutorial/editexample8.html#opening-importing-bitmap-strikes, especially Section 11.2.

Element → Bitmap Strikes Available → put numbers in the boxes to suit (eg 20 in the pixel sizes box) → OK

File → Generate Fonts → No Outline Font (from drop-down) and BDF from the other drop-down → Generate

I let it guess at the resolution (96).

There are now one or more BDF fonts in the same directory as the TTF font. Now we can convert to PSF fonts.

$ bdf2psf --fb Glass_TTY_VT220-20.bdf /usr/share/bdf2psf/standard.equivalents /usr/share/bdf2psf/useful.set 256 Glass_TTY_VT220-20.psf

This gives a font that throws errors and then the screen goes like this:

Weird meaningless screen

Blindly typing setfont /usr/share/consolefont/somefontthatworks.psf.gz gets the screen back to usable.

I think the font table of the PSF must be wrong. The blank is not blank. Space (ie empty) is #32. If I look at the BDF of these fonts, glyph 32 is … space. So the problem is in the conversion.

So it was the convert command — change the ‘set’ part — this works:

$ bdf2psf --fb Glass_TTY_VT220-20.bdf /usr/share/bdf2psf/standard.equivalents /usr/share/bdf2psf/ascii.set 256 Glass_TTY_VT220-20.psf

So if we combine this sort of thing with the amber screen, here we go:

Glass TTY — VT220-like font on a TTY

So there you have it.

I have a little script:

setfont /path/to/Glass_TTY/Glass_TTY_VT220-20.psf
printf %b '\e]P0000000' '\e]P7ffbf00'
clear

A script to put the screen back is left as an exercise! Might need to try a few font pixel sizes to get it just nice, depending on your TrueType font.

 

Blurrk.

Nifty but (not so) obscure #3: The clock package

https://ctan.org/pkg/clock

It will work on modern TeX, but I am installing it on emTeX on FreeDOS (or on DOSBox, although wget won’t work). After verifying that my paths follow those in the emtex.bat file:

cd \tmp
wget http://mirrors.ctan.org/macros/latex/contrib/clock.zip
unzip clock.zip
cd clock
copy emtex emtex.bat
emtex
cd doc
latex clockdoc
latex clockdoc
mkidx32 -s gind.ist clockdoc.idx
mkidx32 -s gglo.ist -o clockdoc.gls clockdoc.glo
latex clockdoc
latex clockdoc
v clockdoc
dvips clockdoc

All great.

Here is our LaTeX file:

\documentclass[12pt]{article}
\usepackage{clock}
\ClockFramefalse
\begin{document}
\verb|\clocktime| -- the time now\ldots \clocktime

\verb|\clock{12}{00}| -- noon\ldots \clock{12}{00}

Now we go again, but first issue \verb|\ClockFrametrue|

\ClockFrametrue

\verb|\clocktime| -- the time now\ldots \clocktime

\verb|\clock{12}{00}| -- noon\ldots \clock{12}{00}

\end{document}

And so output:

The clocks are implemented as fonts, which means many commands that can manipulate fonts can manipulate the clocks (colours, sizes and so on), but there are not font metrics for all sizes or styles, of course. You can select a bigger font using \bigclockfont and select the base font using \clockfont. Loading graphicx will allow \scalebox and so on. Endless fun.

Clocky

 

 

Formatting the default empty document in Word

I should have done this years ago. I want the empty document I get when I start a new one in Word to use a particular set of styles and Australian English.

File > Open > Browse > Type %appdata% in the address bar and hit Enter. Should end up somewhere like:

C:\Users\username\AppData\Roaming

Navigate to C:\Users\username\AppData\Roaming\Microsoft\Templates (or can enter this directly in address bar, with your username) and open Normal.dotm.

Customise — in my case, choose the language, and import the styles I want from a template that I nearly always have to apply to my documents.

Import styles:

Ctrl+Alt+Shift+S to bring up the Styles pane.

Click the A with a check (tick) mark — that is, choose Manage Styles.

Check ‘New documents based on this template’.

Click Import/Export button (lower-left on my dialog). Then click Open File and browse for the template with the styles I want to import.

I (1) select all the styles I want to import (all in my case) and (2) press the <- Copy button.

Then click Close.

Now, I go to Review > Language > Set Proofing Language. I choose the language I want and click Set As Default, and say Yes, that is what I want.

I can now set other things — margins, paper size, details of menus if I like.

Then I save — click the floppy disk icon near the top-left of the screen.

 

OK, close it all, open a new empty document and see if it’s working.

Yep, all the styles are there and the spelling is what I want.

Done.

 

Microsoft Word — good enough since 1997.

 

Star NX-1000 printer via USB to parallel adapter on Windows 10

Install the Star NX-1000 on this laptop

(1) Bought a USB to parallel convertor off ebay — a cheap one (picture)

(2) Plugged it into the laptop

(3) Plugged it into the printer and made sure the printer was online

(4) Went to add printer dialog and after it searched for a bit, chose ‘The printer I want isn’t listed’

(5) Then ‘Add a local printer or network printer with manual settings’

(6) For the port, I chose USB001, then chose my driver (Epson LX Series 1 (80), but depends on DIP switch settings) and printer name; take care to specify the correct paper size, as well. Some fanfold papers, like I have in an old box, are odd sizes (eg 12 inches long), not A4 or letter

(7) Went to print text page — nothing!

(8) Opened printer properties and changed the port to USB002

(9) Then it worked. Can print using Windows GUI from any application. If you want to print from the Windows command line, there’s a bit more work to do. I’m not doing that here.

Take home: The USB00X printer port assigned to the adapter depends on (I think) which USB port you put it in. It’s worth either changing ports in the config or moving the adapter to another one if it does not work. Also, I named the printer Star-front-left-black-USB because I plugged my black USB-to-parallel adapter (I have another one) into the front-left USB port. Star.

Works great.

 

Refilling old plotter pens — the Brother BP-30 (Type-o-graph)

Picture from the advert

Getting this thing to work has been a saga! First, though, a word about how it works. It is rather like an XY plotter in a typewriter format, with the paper roller providing the Y and the pen holder the X.

It holds 4 short ball point pens in a rotating cradle, a bit like a revolver cylinder. To write a letter, a solenoid mounted on the left moves a flat plastic strip, a bit like a ruler, to push on the back of the pen, so the pen contacts the paper. The cradle moves back and forth and the paper up and down and a letter is traced out. Then the solenoid lets go, the cradle moves to the position of the next letter, and it starts again.

My machine had 3 major problems.

  1. No pens that worked (about 10 pens, but all ancient and dry)
  2. The solenoid barely moved
  3. The pusher plate was cracked in several places — probably embrittled by age, and the way it slaps back and forth when you change pens (not great design, that).

In reverse order:

I just ran a strip of tape along the plate to strengthen it and hoped that that would stabilise it. So far so good…

I opened up the case, loosened the solenoid mounting, removed the pin that connected it to the mechanism that moved the plate (had to remove a circlip), and took the rod out the centre of the solenoid. I cleaned it and the bore of the solenoid, then put it back in and adjusted the position of the solenoid by trial and error until it printed well but also lifted off the pen.

The pen part of the story is a bit of an epic. I’ll just talk about what worked.

Key external dimensions
Rough cutaway of a pen

Used 2 pairs of pliers to ease the pen tip out of the barrel. Put some tape over the open end of the barrel to prevent it drying out even more than it already had. See the pictures here for disassembled pens: https://munk.org/typecast/2016/11/19/the-handwriting-drawing-typewriter-brother-type-o-graph-bp-30-with-user-manual/ (I also copied the manual from here — I don’t have one. The Right Reverend Theodore Munk is vastly knowledgeable when it comes to all kinds of typewriters, and is just as interested in obscure electric ones as classic mechanical ones.)

I put the pen tip in a cup of water, put the water in the microwave and got it to boil. Swooshed the water around and watched the ink dissolve out of the pen tip. Repeated this a few times, left the pen tip in the water overnight, then repeated it the next day a few more times. Kept repeating until no ink was visible even in fresh boiling water. Eventually The pen tip was able to write, using a watery mix of the leftover ink and the water that had worked its way in — this was a good sign.

Filled the pen barrel with Chromacryl black water-based non-clogging dye (not pigment) ink (suitable for drafting pens, for example). Reinserted the pen tip.

The pen worked!

Put the pen in the cradle. When the machine tried to change pen colours, the mechanism jammed — the pen was too long, I had not pushed the tip back in far enough. Through a bit of messing around with the solenoid position (its screws let you adjust it a few mm back and forth) and the length of the pen (by shoving in the tip a fraction of a mm at a time and testing) I got a combination of positions and dimensions that worked. Here is my first major session on the machine (there was plenty of typing ‘MMMM’ and so on while trying to get everything in its right place).

For full text, see at end of post
My sample, including pie chart, sideways writing and 3 sizes of text.

I had no right to expect such strong results. I was surprised at how well it worked. (I will admit this image was scanned and then thresholded to improve the contrast). But even the ‘raw’ image is not bad. Here is the character set before and after thresholding.

Before
After

The BP-30 is a strange beast, and after some messing around I have got one to work. Next I need to get more than one pen working so that I can draw other kinds of graphs — it changes pens while drawing graphs, and none of the others work! I have some blue and green stamp pad ink, which I think is dye-based, not pigment-based, and I know is water-based, so it should work…

I wonder if the same method would work for ALPS (Atari etc) 4-colour plotter pens?

The unit
The pen carriage

Text from the scanned typing:

Here we have a Brother BP-30 (type-o-graph). The pen was reinked by gently removing the tip and soaking the tip in hot to boiling water for a couple of days until all the ink was dissolved out of it. I then filled the pen body with Chromacry] non-clogging water-based ink and reassembled the pen. It is very important to insert the tip exactly the right distance so that the length of the pen Is the same before and after. I also had to remove the piston from the solenoid that drives the pusher that pushes the pen against the paper and make sure it could move freely. I also adjusted the solenoid position a little. So far I only have one working pen, so I can only draw a pie chart — the others use more than one colour, I think.

See the machine at work here (crappy little movie made using an old digital camera… sorry — you may need to download it and find a player to make it play): http://djg.altervista.org/downloads/P1010174.MOV. You’ll see me choose ‘Graph’, enter some data and then hit the space bar to start the drawing.

I’ll talk about the unit as a whole some other time.

 

 

Haiku update: WebPositive gets positive review

Looks like the WebPositive team is doing a great job of making sure Haiku can interact with the modern web. Awesome!

December 2020. How well can Haiku work with modern, complex, JavaScript-rich websites? Here is my idiosyncratic random sample. Summary: WebPositive  (1.2-alpha) seems to do a great job. Otter (1.0.81) is handy but a little more limited, possibly because its JavaScript is less up to date. Not sure.

Browser: Otter

Note: JavaScript is enabled in Preferences.

GMX.com email — no problems; full functionality.

Gmail — “Couldn’t sign you in; the browser … JavaScript … ”

AOL mail — “Whoops! It looks like you’re using an unsupported browser …”

Outlook Web — no problems; full functionality.

WordPress — Seems to function well; I use the Classic Editor, so cannot comment on others, but looks good.

Twitter — “This browser is no longer supported.”

Atlassian Confluence — Looks good.

Browser: WebPositive

GMX.com email — no problems; full functionality.

Gmail — looks good!

AOL mail — looks good.

Outlook Web — OK.

WordPress — looks good.

Twitter — OK.

Atlassian Confluence — OK.

 

Haiku

Three layers, seven colours

anotherkatewilson

A while I ago I posted a rant about rainbows. It was triggered by a comment that science ruins rainbows by taking away the magic. My argument in that post was that science adds to their beauty and magic because it allows you to “see” so much more in them.
A couple of days ago I was walking across a carpark and it had just started raining. And there was a stunning rainbow on the ground:

Is it less beautiful to me because I know how the colours come to be there? Because I know the oil film is only a fraction of a micrometre thick? Because I can imagine the waves reflecting at the two interfaces, with an added pirouette at the top? Because I could write the equations and calculate the thickness of the film from the colour of the ribbon? Of course not. But is it…

View original post 127 more words

Xorg on an Alphaserver: just use a thin client

On my old Alpha, X windows works fine when I run vintage operating systems — the main example being Debian 5. But so far I have been unable to get an X server to work using any of the OSs that are still (in 2021) maintained for Alpha. My experience is that OpenBSD (which admits X server is not working), NetBSD and Debian ports can all forward X information to another machine being used as a terminal. So if you run the X server on the client computer, and forward X from the server, you can run X applications on the Alpha no worries. You just can’t run X locally on the Alpha — but, then, it is  server.

So for example I have a Futro thin client.

Front vierw of Futro. Just a big blank screen

It looks like a monitor. I can install Debian on the thin client, and install Xorg server and all that. I fire up the thin client, start the X server and then ssh -X -C into the Alpha and it is pretty much as if I had X running on the Alpha — especially because the Futro is a thin client with a built-in screen, so it rather looks like just a monitor.

I would like to get X to work locally, just ‘cos, but this is functionally a completely adequate solution.

Just coz.

 

 

 

Futro boot screen

 

PowerBI — change 1 value in a column — seriously?

To replace (that is, change) 1 value in a table, you cannot just type in the cell. You have to:

  • Have some kind of column(s) who’s value(s) can be used to identify the cell you want to change
  • Construct an entire new column that uses an IF statement to replace just the one value with its new value
  • Delete the original column
  • Reorder the columns to put the corrected one where the original was

Let’s say I want to change this highlighted cell to be 9 instead of 7. Right-click? Double-click? Click? No.

First, I go to Add Column tab and select Custom Column. Then, in the box, I enter a formula (no, really!):

So, what I have done is author a formula:

New Bag 5 = if([Colour]="Yellow" and [Bag 5]=7)then 9 else [Bag 5]

That is:

Make a new column called ‘New Bag 5’. As you work your way down the column, when you get to a row in which the corresponding value of ‘Colour’ is ‘Yellow’ and of ‘Bag 5’ is 7, then put a 9. Otherwise, just put what you found in ‘Bag 5’.

Now we have a corrected column, so we can delete the original and move this one into its place, and rename it.

Strangely, PowerBI will let you, with a click, replace every instance of a value in a column with some other value. But not just one instance.

Now, in my example ‘Yellow’ only occurs once, so my IF could have been a little simpler. But what if I had ‘Yellow’ twice, and in both rows ‘Bag 5’ was 7 and I only wanted to change one of them? I’d have to find some other way to split the cases. Probably using the index (row number).

I have googled around, and this does seem to be the approved method! For example:

https://community.powerbi.com/t5/Desktop/Replacing-just-1-value-in-a-table/m-p/75871

https://stackoverflow.com/questions/59827153/change-value-of-a-single-cell-in-power-bi

One of these bits of advice says it ‘can easily be done’! I guess it is not that hard. It’s just not as easy –as trivially easy — as it should be.

I’m introducing myself to PowerBI, and this does not look promising!

Certainly makes editing a file using EDLIN seem intuitive.

 

And if you like PowerBI maybe you’ll like TECO, or you’re a fan of Stockholm syndrome

Chevron electric — the Corrector with dandruff

Hello. Here we are using our Chevron (Nakajima ALL) electric typewriter. It called “The Corrector”, but all it really has is a dual-colour ribbon for which one of the colours is white. Otherwise, it is a lot like this other one. It is like having a ribbon of Tipp-Ex. This seems like a reasonable idea until you think about it; then you realise that the end result is going to be a zillion little flakes of white crap clogging up the machine. Which is in fact what happens.

View of it in the case

It looks like a typewriter with dandruff.

You backspace, hold down the Correction key, which just lifts up the ribbon such that the white half will be struck, and retype the erroneous key. Let’s see … (tries it) … there, not too bad. Probably worked quite well when the ribbon was nice and new and the white stuff was more flexible. Now it is old and hardened and flakes off.

Showing the dandruff

OK, apart from that, what can we say? Well, it looks  pretty freaking boring, in lovely 2-tone 1970s brown and beige. It has a reasonably complete set of features — tabs, half-space, repeat space, all from the keyboard. Because the hammers are actuated mechanically, the impression is nicely regular, and we can see that the rows of type are pretty even. (I really should replace the ribbon, but I don’t have a half-white spare, and without the ribbon this thing loses what little interest it has.) The motor is pretty quiet — you cannot really hear the motor, and the electrically driven carriage does not thunder into its stop. It does rather like the word “power”. We have:

  • power shift (twice)
  • pwr back
  • power tab
  • power return.

A few keys can repeat. Space. Full stop, hyphen and underscore (same key as hyphen). Oddly, zero and close bracket (same key) sometimes like to repeat too, usually unasked. One has to try to hit zero as lightly as is reasonable, or it repeats until end of line or you manage to interrupt it in some way.

front-top view

One can see the niche for machines like this. A Selectric cost too much for the average home, and I suspect many smaller businesses might have winced too. A machine like this takes a lot of the physical work out of typing, gives a  decent result, and allows a form of correction. And it would have been a small fraction of the price of a Selectric (or one of the many Selectric clones), and in a pinch you can put any standard ribbon in it and forgo the correction function but keep the machine running.

Type sample, showing the repeating 0 and ) key (in this case it did a bracket then dropped into unshifted and did a bunch of zeroes). Faded bits are because the ribbon is dried out in places. You can type too fast for these — see ‘you’ at bottom-right. But on the whole the type is (mostly) even and the line is (mostly) straight. The ‘t’ in ‘not’ sits on top of an attempted correction.

Today, is it more than a curiosity? No, not really. If you like the thwack of typebars on paper but don’t like the effort a typical manual requires, or like a result a little more regular, I guess it might serve some purpose. The key feel is odd compared to both computer and typewriter. They feel like early computer keys — maybe a VT100 or something — but they operate levers, so have a mechanical movement, but it is much shorter than on a manual typewriter. So you have a mechanical feel but not one like a manual.

I said the motor is quiet — and it is. The strike is not so quiet. Now, this platen might have hardened a bit over the years (though it does still grip the paper), but I suspect this machine was never quiet. You would not use it for some late night writing unless your office was distant or well soundproofed!

I must confess, I actually quite like the output from these sorts of machines. It looks like that from a “real” typewriter, yet is even and regular, as if done by a very fine typist rather than by me.

Here is the symbol set for this machine, repeating zeroes and all:

The symbol set, including accidental repeated zeroes(Serial number E252874)

You can see that this one strikes fairly evenly, with tall characters like $ and # showing fairly even density up their whole height — and this is the ribbon that came with it; I dare say a new one would be better.

So, on the whole, we have a machine that looks undistinguished, does not ‘feel’ expensive under the fingers, and makes quite a lot of noise and fills itself up with dandruff. On the other hand, these things are very cheap (if not free) second hand, and produce a nice, regular line of type — as long as the ribbon itself is evenly inked, which this one is not. If you wanted a typewriter that goes whap whap whap you could do worse.

This one came with the cord cut because it had failed an electrical safety test. On opening it up, I found that there was some greasy stuff around the tag board where the power cord joins the internal circuitry. I removed the tag board, gave everything a good clean, and attached a power cord with an earth that I new was continuous. The thing past every test after that and has been fine since. I have not been able to cure the repeating closing brackets, though I have not tried very hard. I can cheat and use capital oh (O) for zero, but I have to avoid closing brackets (which means avoiding opening them too) or just hope for the best.

Anyway, it is distinctly less effort to use than a normal manual, but not as nice as the similar-in-principle Hermes 10, which I have talked about elsewhere; but that would have been a much more expensive machine…

$10