Hello !
I need help by a guru in ATSU/text drawing !
I'm porting an app written in C to Mac.
This app draws aligned protein sequences, i.e. a succession of letters (20 letters + '.'). Each letter has a foreground and a background color (F white fg, red bg). The font is ALWAYS the same for all characters and is a fixed font like Courier. My app consists in drawing a matrix of colored characters in a single font, the characters being drawn depend on the position of the scrollbars.
The inner drawing loop is someething like :
y=y0;
for (j=startY;j<startY+linesPerPage;j++) {
x=x0;
for (i=startX;i<startX+charsPerLine;i++) {
c = T[j];
fg = FgColor[c];
bg = BgColor[c];
<DrawText(context, layout, c, fg, bg, x, y,font)>
}
}
The routines to draw text are :
Unix :
-with Xft enabled :
XftDrawRect, XftDrawString8
-without Xft :
XDrawImageString
Windows :
- set drawable context SetBkColor(hdc,bg) , SetTextColor(hdc, fg)
- print text : TextOut(hdc,x, y, string, length)
For sake of compatibility, I must use the ATSUI framework.
Can someone explain me how to achieve this ?
- where goes the foreground/background color ? in the style or layout ?
- should I use ATSUDrawText ?
- where should I initialise the layout ?
Thanks for your help ! Please unserstand that I'm primarily a biologist, and that I can't learn all drawing API !! ;-)
Luc
I need help by a guru in ATSU/text drawing !
I'm porting an app written in C to Mac.
This app draws aligned protein sequences, i.e. a succession of letters (20 letters + '.'). Each letter has a foreground and a background color (F white fg, red bg). The font is ALWAYS the same for all characters and is a fixed font like Courier. My app consists in drawing a matrix of colored characters in a single font, the characters being drawn depend on the position of the scrollbars.
The inner drawing loop is someething like :
y=y0;
for (j=startY;j<startY+linesPerPage;j++) {
x=x0;
for (i=startX;i<startX+charsPerLine;i++) {
c = T[j];
fg = FgColor[c];
bg = BgColor[c];
<DrawText(context, layout, c, fg, bg, x, y,font)>
}
}
The routines to draw text are :
Unix :
-with Xft enabled :
XftDrawRect, XftDrawString8
-without Xft :
XDrawImageString
Windows :
- set drawable context SetBkColor(hdc,bg) , SetTextColor(hdc, fg)
- print text : TextOut(hdc,x, y, string, length)
For sake of compatibility, I must use the ATSUI framework.
Can someone explain me how to achieve this ?
- where goes the foreground/background color ? in the style or layout ?
- should I use ATSUDrawText ?
- where should I initialise the layout ?
Thanks for your help ! Please unserstand that I'm primarily a biologist, and that I can't learn all drawing API !! ;-)
Luc