fwcd / worldwideweb-cocoa

Experimental port of Tim Berners-Lee's original WorldWideWeb browser for NeXTStep to modern macOS (Cocoa/AppKit)
Other
0 stars 1 forks source link

Migrate legacy NeXTStep APIs to Cocoa/AppKit #2

Open fwcd opened 4 months ago

fwcd commented 4 months ago

While the legacy NeXTStep API has substantial similarities to the modern AppKit, there are a number of differences, most notably including the change of the NX prefix to NS (but lots of other things have changed too over the last 30 years).

Discoveries

Useful resources

chrisbrandow commented 2 months ago

I got interested in this myself, and started trying to understand the Text class, as well as its property theRuns. As you may already be aware, I the NXRun class is akin to NSRange, but contains the attributes being applied to a section of text.

I looked at CoreText documentation, and some vestiges of this may be present:

from the documentation of CTRunDelegate

A run delegate is assigned to a run (attribute range) to control typographic traits such glyph ascent, glyph descent, and glyph width.

https://developer.apple.com/documentation/coretext/ctrundelegate?language=objc

update:

more to the point is the CTRun class https://developer.apple.com/documentation/coretext/ctrun?language=objc

update further:

There are likely many good examples, but this project on GH implements a TextView markup in CoreText based in relevant parts on CTRun: https://github.com/LiveUI/FTCoreText/tree/master