qnx font fixes.

From: phearbear (phearbear@home.se)
Date: Thu Mar 28 2002 - 10:46:22 EST

  • Next message: Dom Lachowicz: "Commit: Re: qnx font fixes."

    Hi

    Attaching a patch which fixes some problems with the Fonts.
    I also, temporary disabled the Insert Symbol dialog, and all non
    scalable font, ie, the symbol font.
    The rest is simply renaming a few functions that have changed name in
    QNX 6.1 and hadn't been updated in the source.
    oh yeah, fixed the asserts in refreshtoolbar that Patrick mentioned.

    /Johan

    Index: af/ev/qnx/ev_QNXToolbar.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/af/ev/qnx/ev_QNXToolbar.cpp,v
    retrieving revision 1.23
    diff -u -r1.23 ev_QNXToolbar.cpp
    --- af/ev/qnx/ev_QNXToolbar.cpp 28 Mar 2002 08:17:40 -0000 1.23
    +++ af/ev/qnx/ev_QNXToolbar.cpp 28 Mar 2002 14:36:34 -0000
    @@ -607,6 +607,24 @@
                                     }
                                     break;
     
    +
    + case EV_TBIT_ColorFore:
    + case EV_TBIT_ColorBack:
    + {
    + bool bGrayed = EV_TIS_ShouldBeGray(tis);
    +
    + tcb = (struct _cb_data *) m_vecToolbarWidgets.getNthItem(k);
    + UT_ASSERT(tcb);
    + PtWidget_t *item;
    + item = tcb->m_widget;
    + UT_ASSERT(item);
    +
    + // Disable/enable toolbar item
    + PtSetArg(&args[n++], Pt_ARG_FLAGS,
    + (bGrayed) ? (Pt_BLOCKED | Pt_GHOST) : Pt_SELECTABLE,
    + Pt_BLOCKED | Pt_GHOST | Pt_SELECTABLE);
    + PtSetResources(tcb->m_widget, n, args);
    + }break;
                                     case EV_TBIT_StaticLabel:
                                             break;
                                     case EV_TBIT_Spacer:
    Index: af/gr/qnx/gr_QNXGraphics.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/af/gr/qnx/gr_QNXGraphics.cpp,v
    retrieving revision 1.42
    diff -u -r1.42 gr_QNXGraphics.cpp
    --- af/gr/qnx/gr_QNXGraphics.cpp 26 Mar 2002 08:05:54 -0000 1.42
    +++ af/gr/qnx/gr_QNXGraphics.cpp 28 Mar 2002 14:36:35 -0000
    @@ -262,36 +262,33 @@
     {
             PhRect_t rect;
             const char *font;
    - char buffer[MB_CUR_MAX + 1];
             int len, indices, penpos;
    + UT_UCSChar buffer[1];
     
    - if (!m_pFont || !(font = m_pFont->getFont())) {
    + buffer[0]=c;
    +if (!m_pFont || !(font = m_pFont->getFont())) {
                     return 0;
             }
     
    - len = wctomb(buffer, c);
    - UT_ASSERT(len > 0);
    - buffer[len] = '\0';
             indices = 1;
             penpos = 0;
    -
     /*
             printf("wide character %d (0x%x) [%c] in %s ==\n", c, c, (char)c, font);
             printf("multi byte char 0x%x 0x%x 0x%x 0x%x (%d) \n", buffer[0], buffer[1], buffer[2], buffer[3], len);
     */
             PfExtentTextCharPositions(&rect, /* Rect extent */
                                       NULL, /* Position offset */
    - buffer, /* Buffer to hit */
    + (char*)buffer, /* Buffer to hit */
                                       font, /* Font buffer uses */
                                       &indices, /* Where to get pen pos from */
                                       &penpos, /* Where to store pen pos */
                                       1, /* Number of indices */
    - 0, /* Flags TODO: PF_WIDE_CHARS and save convert? */
    - len, /* Length of buffer (0 = use strlen) */
    + PF_WIDE_CHARS, /* Flags */
    + 0, /* Length of buffer (0 = use strlen) */
                                       0, /* Number of characters to skip */
                                       NULL); /* Clipping rectangle? */
     /*
    - printf("gives width %d \n", penpos);
    + printf("gives width %d and char = 0x%x\n", penpos,c);
     */
             
             return penpos;
    @@ -409,18 +406,18 @@
     
     UT_uint32 GR_QNXGraphics::getFontAscent()
     {
    - if(m_iAscentCache == -1) {
    +// if(m_iAscentCache == -1) {
                     m_iAscentCache = getFontAscent(m_pFont);
    - }
    +// }
     
             return m_iAscentCache;
     }
     
     UT_uint32 GR_QNXGraphics::getFontDescent()
     {
    - if (m_iDescentCache == -1) {
    +// if (m_iDescentCache == -1) {
                     m_iDescentCache = getFontDescent(m_pFont);
    - }
    +// }
     
             return m_iDescentCache;
     }
    @@ -438,7 +435,7 @@
                     
             FontQueryInfo info;
     
    - if (PfQueryFont(pQNXFont->getFont(), &info) == -1) {
    + if (PfQueryFontInfo(pQNXFont->getFont(), &info) == -1) {
                     UT_ASSERT(0);
                     return(0);
             }
    @@ -453,7 +450,7 @@
                     
             FontQueryInfo info;
     
    - if (PfQueryFont(pQNXFont->getFont(), &info) == -1) {
    + if (PfQueryFontInfo(pQNXFont->getFont(), &info) == -1) {
                     UT_ASSERT(0);
                     return(0);
             }
    @@ -471,11 +468,11 @@
                     
             FontQueryInfo info;
     
    - if (PfQueryFont(pQNXFont->getFont(), &info) == -1) {
    + if (PfQueryFontInfo(pQNXFont->getFont(), &info) == -1) {
                     UT_ASSERT(0);
                     return(0);
             }
    -
    + if(strcmp(pQNXFont->getFont(),info.font) != 0)
             return MY_ABS(info.descender) + MY_ABS(info.ascender);
     }
     
    Index: af/xap/qnx/xap_QNXDlg_FontChooser.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/af/xap/qnx/xap_QNXDlg_FontChooser.cpp,v
    retrieving revision 1.7
    diff -u -r1.7 xap_QNXDlg_FontChooser.cpp
    --- af/xap/qnx/xap_QNXDlg_FontChooser.cpp 6 Feb 2001 22:54:17 -0000 1.7
    +++ af/xap/qnx/xap_QNXDlg_FontChooser.cpp 28 Mar 2002 14:36:35 -0000
    @@ -85,7 +85,7 @@
                                                                                  pSS->getValue(XAP_STRING_ID_DLG_UFS_FontTitle),
                                                                                 "helv10", /* Initial font */
                                                                                 -1, /* Symbol to select fonts by */
    - PHFONT_ALL_FONTS, /* Which type of fonts */
    + PHFONT_SCALABLE, /* Which type of fonts */
                                                                                 NULL); /* Sample string */
     
             if (newfont) {
    @@ -93,7 +93,7 @@
                     char *s, *p, c;
     
                     //NOTE: I could use PfQueryFont for all this information
    - PfQueryFont(newfont, &finfo);
    + PfQueryFontInfo(newfont, &finfo);
     
                     //Split name[size][style] into pieces
                     s = p = newfont;
    Index: af/xap/qnx/xap_QNXDlg_Insert_Symbol.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/af/xap/qnx/xap_QNXDlg_Insert_Symbol.cpp,v
    retrieving revision 1.11
    diff -u -r1.11 xap_QNXDlg_Insert_Symbol.cpp
    --- af/xap/qnx/xap_QNXDlg_Insert_Symbol.cpp 15 Jan 2001 11:33:38 -0000 1.11
    +++ af/xap/qnx/xap_QNXDlg_Insert_Symbol.cpp 28 Mar 2002 14:36:35 -0000
    @@ -213,6 +213,7 @@
     
     void XAP_QNXDialog_Insert_Symbol::runModeless(XAP_Frame * pFrame)
     {
    + #if 0
             unsigned short w, h;
     
             // First see if the dialog is already running
    @@ -290,6 +291,8 @@
             UT_QNXCenterWindow(parentWindow, mainWindow);
             PtRealizeWidget(mainWindow);
             PgFlush();
    +#endif
    +UT_ASSERT(0);
     }
     
     void XAP_QNXDialog_Insert_Symbol::event_OK(void)
    Index: wp/ap/qnx/ap_QNXToolbar_FontCombo.cpp
    ===================================================================
    RCS file: /cvsroot/abi/src/wp/ap/qnx/ap_QNXToolbar_FontCombo.cpp,v
    retrieving revision 1.4
    diff -u -r1.4 ap_QNXToolbar_FontCombo.cpp
    --- wp/ap/qnx/ap_QNXToolbar_FontCombo.cpp 18 Jun 2001 12:56:06 -0000 1.4
    +++ wp/ap/qnx/ap_QNXToolbar_FontCombo.cpp 28 Mar 2002 14:36:36 -0000
    @@ -58,8 +58,8 @@
             // nothing to purge. contents are static strings
     }
     
    -#define FONT_QUERY_CHAR 'A'
    -#define FONT_TYPES (PHFONT_SCALABLE | PHFONT_BITMAP | PHFONT_PROP /* | PHFONT_FIXED*/)
    +#define FONT_QUERY_CHAR PHFONT_ALL_SYMBOLS
    +#define FONT_TYPES (PHFONT_SCALABLE /*| PHFONT_BITMAP*/ | PHFONT_PROP /* | PHFONT_FIXED*/)
     bool AP_QNXToolbar_FontCombo::populate(void)
     {
             FontDetails *font_list;



    This archive was generated by hypermail 2.1.4 : Thu Mar 28 2002 - 09:47:49 EST