Re: [9fans] p9p on Retina Macs

2013-09-06 Thread James A. Robinson
On Thu, Sep 5, 2013 at 9:14 PM, Russ Cox r...@swtch.com wrote:

 The lack of on-the-fly font resizing is a continual source of pain for me
 (I end up having to restart acme a lot), and at some point I will finish
 it. Ideally I want to get to the point where devdrawretina=1 acme (no other
 arguments) just works.


Interesting!  I had asked earlier about simulating events and sending
them to acme from external programs because I had wanted to create
a Font+ and Font- set of commands to increase and decrease the
font size.

It's easy enough to get a list of the font sizes available for the current
font using fontsrv(1), and then select the previous or following size,
but I couldn't see any way to actually send that font path into the Font
command of the target window via the external program.

Jim


Re: [9fans] p9p on Retina Macs

2013-09-05 Thread marius a . eriksen
Thanks for the pointers.

I finally did some sleuthing and experimentation.

Indeed, devdraw now knows about a display’s DPI, and launching a devdraw app 
with environment devdrawretina=1 enables detection of retina displays, and 
setting the current DPI accordingly.

DPI seems to affect a few things:

1. computing geometries of fixed-sized UI elements like scroll bars
2. computing scroll “ticks”

⌘-R toggles the current DPI from “retina” (220 DPI) to “non-retina” (110 DPI).

There doesn’t seem to be any sort of built-in font scaling at the moment. So 
when you launch, say, acme on a retina machine, you’ll have to supply your own 
(larger) font. I ended up using fontsrv with system fonts:

% devdrawretina=1 acme -f /mnt/font/HelveticaNeue-Medium/24a/font -F 
/mnt/font/Menlo-Regular/22a/font 

seems to work pretty well.

-m.




Re: [9fans] p9p on Retina Macs

2013-09-05 Thread Russ Cox
What Marius wrote is mostly accurate. If you set devdrawretina=1 you get
tinier pixels; acme, sam, and 9term know to draw thicker lines in response;
other programs do not.

If you want fonts that look somewhat like the Plan 9 bitmaps, I use this
with acme:

#!/bin/bash
export devdrawretina=1
/usr/local/plan9/bin/acme -f /mnt/font/LucidaGrande/25a/font -F
/mnt/font/Menlo-Regular/25a/font $@

It would be nice if acme, sam, 9term adjusted the font size to match the
display DPI accordingly. I have code that does this (I lied above; I
actually start acme with size 15a fonts and it scales to decide to use the
25a fonts), but I am not happy enough with it yet. The main thing that is
missing is that if the window changes from retina to non-retina or vice
versa (for example, you use a retina laptop with an external monitor and
drag a window from one screen to the other), acme and sam know to redraw
with thicker or thinner lines but I don't quite have to font adjustment
during resize correct.

The lack of on-the-fly font resizing is a continual source of pain for me
(I end up having to restart acme a lot), and at some point I will finish
it. Ideally I want to get to the point where devdrawretina=1 acme (no other
arguments) just works.

For fun, try 'devdrawretina=1 9term -f /mnt/font/Menlo-Regular/80a/font'
and then in that window run 'unicode fffe'.

Russ


Re: [9fans] p9p on Retina Macs

2013-09-05 Thread marius eriksen

On Sep 5, 2013, at 9:14 PM, Russ Cox r...@swtch.com wrote:

 For fun, try 'devdrawretina=1 9term -f /mnt/font/Menlo-Regular/80a/font' and 
 then in that window run 'unicode fffe’.

Oh yes. I have been enjoying the pjw stare.

-m.



Re: [9fans] p9p on Retina Macs

2013-08-16 Thread Rob Pike
Russ added a couple of helper things to the library. There's now a
'dpi' field in Display and helpers for scaling. I don't remember the
details but a little digging with that pointer should do it. I vaguely
remember you can also specify a scaling integer in the value of $font.
I write a little subfont scaler that he used to generate upscaled
fonts. Have a look around and report back.

-rob