[Oberon] ETHO Display structure.

eas lab lab.eas at gmail.com
Fri Mar 8 15:52:31 CET 2013


Someone recently was asking about the Aos Display structure.

With some much appreciated pointers from Paul Reed I was able to
extract the following confirmation of the unexpected complexity
of the algorithm to GetCharAtCursor:--

TextFrames.LocateChar [with my comments] shows
# first use the Y-coordinate to get the line
    LocateLine(F, y, loc);
    LOOP
# consult the library re. the bitmap of the char just read
      R.lib.GetObj(R.lib, ORD(ch), obj);
# to see how many 'pixels' wide it is
      dx := obj(Fonts.Char).dx;
# if adding this char/brick to the line exceeds the X-coordinate
#    THEN you've 'arrived' ELSE accumulate the X-coordinate
# and get the next char/brick
      INC(pos); ox := ox + dx; Texts.Read(R, ch)

So it needs to step through each variable-width-char of the
row, consulting the <manufacturers spec> about the char's width,
to add the char-width to the accumulating line-length,
until exceeding the X-coordinate.

What I actually wanted was 'the last char read', which is still
in the global ch, immediately after TextFrames.LocateChar
exits; which i've used and confirm/tested.

TextFrames.LocateChar in fact updates a RECORD which
has the position/index in the corresponding Text.
So you'd normally just read-the-Text-at-position to get
the Char.

I can't see how to use LocateChar, without modifying the existing TextFrames.Mod

Firstly because LocateChar is not exported and also because, I want to
just grab the global ch immediately LocateChar exits, instead of going
indirectly via the position in <Text that TextFrames> was reading.
And I don't know how my module would get the Text that TextFrames
is reading.

What are the rules/guidline for extending existing code?

I've never worked 'in a team'.

== Chris Glur.



More information about the Oberon mailing list