Comment fixes: typos and spacing.
[AROS.git] / rom / intuition / printitext.c
blob81157717d5f94e44a0080bbc67a55812ee0cd73b
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <string.h>
8 #include <proto/graphics.h>
9 #include "intuition_intern.h"
11 /*****************************************************************************
13 NAME */
14 #include <graphics/rastport.h>
15 #include <graphics/rpattr.h>
16 #include <intuition/intuition.h>
17 #include <proto/intuition.h>
19 AROS_LH4(void, PrintIText,
21 /* SYNOPSIS */
22 AROS_LHA(struct RastPort *, rp, A0),
23 AROS_LHA(struct IntuiText *, iText, A1),
24 AROS_LHA(LONG , leftOffset, D0),
25 AROS_LHA(LONG , topOffset, D1),
27 /* LOCATION */
28 struct IntuitionBase *, IntuitionBase, 36, Intuition)
30 /* FUNCTION
31 Render an IntuiText in the specified RastPort with the
32 specified offset.
34 INPUTS
35 rp - Draw into this RastPort
36 iText - Render this text
37 leftOffset, topOffset - Starting-Point. All coordinates in the
38 IntuiText structures are relative to this point.
40 RESULT
41 None.
43 NOTES
45 EXAMPLE
47 BUGS
49 SEE ALSO
51 INTERNALS
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 int_PrintIText(rp, iText, leftOffset, topOffset, FALSE, IntuitionBase);
59 AROS_LIBFUNC_EXIT
61 } /* PrintIText */
63 void int_PrintIText(struct RastPort * rp, struct IntuiText * iText,
64 LONG leftOffset, LONG topOffset, BOOL ignore_attributes,
65 struct IntuitionBase *IntuitionBase)
68 struct GfxBase *GfxBase = GetPrivIBase(IntuitionBase)->GfxBase;
69 IPTR apen;
70 IPTR bpen;
71 IPTR drmd;
72 #ifdef __MORPHOS__
73 IPTR penmode;
74 #endif
75 UBYTE style;
76 struct TextFont *font;
77 struct TextFont *newfont = NULL;
79 EXTENDWORD(leftOffset);
80 EXTENDWORD(topOffset);
82 DEBUG_PRINTITEXT(dprintf("int_PrintIText: rp %p text %p Left %ld Top %ld IgnoreAttrs %ld\n",
83 rp, iText, leftOffset, topOffset, ignore_attributes));
85 /* Store important variables of the RastPort */
86 #ifdef __MORPHOS__
87 GetRPAttrs(rp,RPTAG_PenMode,(IPTR)&penmode,RPTAG_APen,(IPTR)&apen,
88 RPTAG_BPen,(IPTR)&bpen,RPTAG_DrMd,(IPTR)&drmd,TAG_DONE);
89 #else
90 GetRPAttrs(rp,RPTAG_APen,(IPTR)&apen,
91 RPTAG_BPen,(IPTR)&bpen,RPTAG_DrMd,(IPTR)&drmd,TAG_DONE);
92 #endif
94 font = rp->Font;
95 style = rp->AlgoStyle;
97 /* For all borders... */
98 for ( ; iText; iText = iText->NextText)
100 if (!ignore_attributes)
102 /* Change RastPort to the colors/mode specified */
103 SetABPenDrMd (rp, iText->FrontPen, iText->BackPen, iText->DrawMode);
106 if (iText->ITextFont)
108 newfont = OpenFont (iText->ITextFont);
110 if (newfont)
111 SetFont (rp, newfont);
113 SetSoftStyle(rp, iText->ITextFont->ta_Style, AskSoftStyle(rp));
116 /* Move to initial position */
117 Move (rp
118 , iText->LeftEdge + leftOffset
119 , iText->TopEdge + topOffset + rp->Font->tf_Baseline
121 Text (rp, iText->IText, strlen (iText->IText));
123 if (iText->ITextFont)
125 if (newfont)
127 SetFont (rp, font);
128 CloseFont (newfont);
133 /* Restore RastPort */
134 #ifdef __MORPHOS__
135 SetRPAttrs(rp,RPTAG_APen,apen,RPTAG_BPen,bpen,RPTAG_DrMd,drmd,RPTAG_PenMode,penmode,TAG_DONE);
136 #else
137 SetRPAttrs(rp,RPTAG_APen,apen,RPTAG_BPen,bpen,RPTAG_DrMd,drmd,TAG_DONE);
138 #endif
139 SetFont (rp, font);
140 SetSoftStyle (rp, style, AskSoftStyle(rp));