PrintTiogaSelection:
PUBLIC
PROC [
p: VEC,
color: Color,
context: Context ¬ NIL,
screenStyle: BOOL ¬ FALSE]
RETURNS [error: ROPE] ~ {
c: Context ~ context;
bounds: Rectangle ¬ ImagerBackdoor.GetBounds[c];
formattedNode: TiogaImager.FormattedNodes;
reader: TiogaAccessViewers.Reader ~ TiogaAccessViewers.FromSelection[];
location: TextNode.Location ~ [NARROW[TiogaAccess.GetLocation[reader].node], 0];
IF location.node = NIL THEN RETURN["Bad Text"];
IF color = NIL THEN color ¬ ImagerBackdoor.GetColor[context];
formattedNode ¬ TiogaImager.FormatNodes[location, [bounds.w, bounds.h], IF screenStyle THEN screen ELSE print];
Imager.SetColor[c, color];
TiogaImager.Render[formattedNode.box, c, [p.x, p.y]];
};
PrintRope:
PUBLIC PROC [
rope: ROPE,
p: VEC,
color: Color ¬ NIL,
font: ROPE ¬ NIL,
size: REAL ¬ 14.0,
context: Context ¬ NIL]
~ {
IF font = NIL THEN font ¬ "helvetica-mrr";
Imager.SetFont[context, Imager.FindFontScaled[Rope.Concat["xerox/pressfonts/", font], size]];
IF color # NIL THEN Imager.SetColor[context, color];
Draw2d.Label[context, [p.x, ImagerBackdoor.GetBounds[context].h-p.y], rope];
};