some fixes to accented characters
[tangerine.git] / rom / intuition / printitext.c
blob7b43dc5b426d69f06fa55a661823ce6e2de1c36f
1 /*
2 Copyright © 1995-2007, 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 HISTORY
54 29-10-95 digulla automatically created from
55 intuition_lib.fd and clib/intuition_protos.h
57 *****************************************************************************/
59 AROS_LIBFUNC_INIT
61 int_PrintIText(rp, iText, leftOffset, topOffset, FALSE, IntuitionBase);
63 AROS_LIBFUNC_EXIT
65 } /* PrintIText */
67 void int_PrintIText(struct RastPort * rp, struct IntuiText * iText,
68 LONG leftOffset, LONG topOffset, BOOL ignore_attributes,
69 struct IntuitionBase *IntuitionBase)
72 IPTR apen;
73 IPTR bpen;
74 IPTR drmd;
75 IPTR penmode;
76 UBYTE style;
77 struct TextFont *font;
78 struct TextFont *newfont = NULL;
80 EXTENDWORD(leftOffset);
81 EXTENDWORD(topOffset);
83 DEBUG_PRINTITEXT(dprintf("int_PrintIText: rp %p text %p Left %ld Top %ld IgnoreAttrs %ld\n",
84 rp, iText, leftOffset, topOffset, ignore_attributes));
86 /* Store important variables of the RastPort */
87 #ifdef __MORPHOS__
88 GetRPAttrs(rp,RPTAG_PenMode,(IPTR)&penmode,RPTAG_APen,(IPTR)&apen,
89 RPTAG_BPen,(IPTR)&bpen,RPTAG_DrMd,(IPTR)&drmd,TAG_DONE);
90 #else
91 GetRPAttrs(rp,RPTAG_APen,(IPTR)&apen,
92 RPTAG_BPen,(IPTR)&bpen,RPTAG_DrMd,(IPTR)&drmd,TAG_DONE);
93 #endif
95 font = rp->Font;
96 style = rp->AlgoStyle;
98 /* For all borders... */
99 for ( ; iText; iText = iText->NextText)
101 if (!ignore_attributes)
103 /* Change RastPort to the colors/mode specified */
104 SetABPenDrMd (rp, iText->FrontPen, iText->BackPen, iText->DrawMode);
107 if (iText->ITextFont)
109 newfont = OpenFont (iText->ITextFont);
111 if (newfont)
112 SetFont (rp, newfont);
114 SetSoftStyle(rp, iText->ITextFont->ta_Style, AskSoftStyle(rp));
117 /* Move to initial position */
118 Move (rp
119 , iText->LeftEdge + leftOffset
120 , iText->TopEdge + topOffset + rp->Font->tf_Baseline
122 Text (rp, iText->IText, strlen (iText->IText));
124 if (iText->ITextFont)
126 if (newfont)
128 SetFont (rp, font);
129 CloseFont (newfont);
134 /* Restore RastPort */
135 #ifdef __MORPHOS__
136 SetRPAttrs(rp,RPTAG_APen,apen,RPTAG_BPen,bpen,RPTAG_DrMd,drmd,RPTAG_PenMode,penmode,TAG_DONE);
137 #else
138 SetRPAttrs(rp,RPTAG_APen,apen,RPTAG_BPen,bpen,RPTAG_DrMd,drmd,TAG_DONE);
139 #endif
140 SetFont (rp, font);
141 SetSoftStyle (rp, style, AskSoftStyle(rp));