rem: WMDrawString(rPtr->view->screen, rPtr->drawBuffer, rPtr->fg, rPtr->font, rPtr->margins.left+2, 26, "0   inches", 10);
add: i=j=m=0; w = rPtr->view->size.width - rPtr->margins.left; while(m < w) { XDrawLine(rPtr->view->screen->display, rPtr->drawBuffer, rPtr->fg, rPtr->margins.left+m, 23, rPtr->margins.left+m, marks[i%8]+23); if(i!=0 && i%8==0) { if(j<10) snprintf(c,3,"%d",++j); else snprintf(c,3,"%2d",++j); WMDrawString(rPtr->view->screen, rPtr->drawBuffer, rPtr->fg, rPtr->font, rPtr->margins.left+2+m, 26, c, 2); } m = (++i)*10; }
context: drawRulerOnPixmap(Ruler *rPtr){    int i, j, w, m;    char c[3];    int marks[9] = {11, 3, 5, 3, 7, 3, 5, 3};if(!rPtr->drawBuffer)    createDrawBuffer(rPtr);XFillRectangle(rPtr->view->screen->display, rPtr->drawBuffer,               rPtr->bg, 0, 0, rPtr->view->size.width, 40);WMDrawString(rPtr->view->screen, rPtr->drawBuffer,             rPtr->fg, rPtr->font, rPtr->margins.left+2, 26, "0   inches", 10);/* marker ticks */i=j=m=0;w = rPtr->view->size.width - rPtr->margins.left;while(m < w) {    XDrawLine(rPtr->view->screen->display, rPtr->drawBuffer,              rPtr->fg, rPtr->margins.left+m, 23,              rPtr->margins.left+m, marks[i%8]+23);    if(i!=0 && i%8==0) {        if(j<10)            snprintf(c,3,"%d",++j);        else            snprintf(c,3,"%2d",++j);        WMDrawString(rPtr->view->screen, rPtr->drawBuffer,                     rPtr->fg, rPtr->font, rPtr->margins.left+2+m, 26, c, 2);    }    m = (++i)*10;}rPtr->end = rPtr->margins.left+m-10;if(rPtr->margins.right > rPtr->end)    rPtr->margins.right = rPtr->end;/* base line */XDrawLine(rPtr->view->screen->display, rPtr->drawBuffer,          rPtr->fg, rPtr->margins.left, 22, rPtr->margins.left+m-10, 22);drawLeftMarker(rPtr);drawRightMarker(rPtr);drawFirstMarker(rPtr);drawBodyMarker(rPtr);}