Acknowledged

Vector Fonts different size for different numbers?

Hi,

I don't understand exactly the zize parameter of getVectorFont. I have try to use vector fonts for new watch types f965 or epix2.

The size of font is not increase constantly with the size parameter. Some numbers are bigger then others.

var MarksFont = Gfx.getVectorFont({:face=>["RobotoRegular","Swiss721Regular"], :size=>34}) as Gfx.VectorFont;
dc.drawText(100,  100, MarksFont , "1234567890", Gfx.TEXT_JUSTIFY_RIGHT);

 Unfortunately I can't upload a picture to demonstrate it.

I use the latest SDK 6.3.0

What is going wrong?

  • Thanks for your try to reproduce the issue. The devices are all uptodate, But I can't also not more reproduce this today.

    It seems this is an sumulator problem. I had change the devices from fr965 to epix 2 51mm and change the size of font in code without closing the simulator. Then the fonts not correct show then, when I start an other device.

    If I close the simulator and restart it, then the font correct show. I seems if an other font used from the face array for other device, then the simulator gives back not  the correct font.

      

  • I am not seeing this issue with the code snippet provided. Are your device files up-to-date for the simulator? Is there also a chance that we could see the app (you can send the source to [email protected] for privacy). Or maybe even just a larger code snippet? Thanks

  • I can't reproduce this using the following simple test case.

    import Toybox.Application;
    import Toybox.Graphics;
    import Toybox.Lang;
    import Toybox.WatchUi;
    
    class NoBuenoView extends WatchUi.View {
    
        hidden var _mLines as Array<String>;
        hidden var _mFont as VectorFont?;
    
        function initialize() {
            View.initialize();
    
            _mLines = [] as Array<String>;
        }
    
        function onShow() as Void {
            _mLines = [] as Array<String>;
            _mLines.add("1234567890");
            //_mLines.add(_mLines[0].toCharArray().toString());
    
            _mFont = Graphics.getVectorFont({
                :face => ["RobotoRegular", "Swiss721Regular"] as Array<String>,
                :size => 34
            });
        }
    
        function onUpdate(dc as Dc) as Void {
            dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_WHITE);
            dc.clear();
    
            var cx = dc.getWidth() / 2;
            var cy = dc.getHeight() / 2;
    
            var font = _mFont;
    
            if (font != null) {
                var fy = dc.getFontHeight(font);
    
                cy -= (fy * _mLines.size() / 2);
    
                for (var i = 0; i < _mLines.size(); ++i) {
                    dc.drawText(cx, cy, font, _mLines[i], Graphics.TEXT_JUSTIFY_CENTER);
                    cy += fy;
                }
            }
        }
    }
    
    class NoBuenoApp extends Application.AppBase {
    
        function initialize() {
            AppBase.initialize();
        }
    
        function getInitialView() as Array<Views or InputDelegates>? {
            var view = new NoBuenoView();
            return [ view ] as Array<Views or InputDelegates>?;
        }
    }
    

    It seems that something is twiddling the scale, either when rendering the glyph or when generating the font data. We might be able to determine which it is by printing a string of the same character ("123412431432") and see if the 4s appear with the same height or not.

    It would help us immensely if you could send a .zip of an app that can be used to reproduce the problem to [email protected]. It doesn't necessarily have to be a reduced testcase... just something we can use to reproduce the problem. Be sure to mention me (Travis.ConnectIQ) in the subject so it is routed correctly.

  • Ah ok, here a sample: one string with one size 34

  • You can post a picture as a reply to your original post.