Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Qt: monotype Font on BB10

This code

    QFont font = QApplication::font();
    font.setPointSize(14);
    font.setStyleStrategy(QFont::ForceIntegerMetrics);
    QFontMetrics fm(font);
    double x=fm.width("A");
    fprintf(stderr, "Width of A is %f\n",x);
    x=fm.width("j");
    fprintf(stderr, "Width of j is %f\n",x);

 on Playbook gives:

Width of A is 12.000000
Width of j is 12.000000

on BB10 it gives:

Width of A is 7.000000
Width of j is 3.000000

 

I don't care whether it is 12 or 7 but I'd like this to be the same for all characters. I've tried choosing all fonts in /usr/fonts/font_repository/monotype and tried specifying

font.setStyleHint(QFont::TypeWriter);

with no success, please help.

Thanks.