digital font - transparent trick?

Hello, could anyone tell me how to make a transparent font, as it is on a digital watch, for example? Is this a font trick, or is it necessary to use a special font?

I only need to have numbers displayed this way.

Thank you for answer.

  • 		function drawTime(dc, clockTime, is24Hour) {
    		var x = $.SCREEN_WIDTH / 2 + 28 - (is24Hour ? 0 : 2), y = 140;
           
      		var hours = clockTime.hour;
      		hours = !is24Hour && hours > 12 ? hours - 12 : hours; 
            var time = Lang.format("$1$:$2$", [hours, clockTime.min.format("%02d")]);
            
    		
    		dc.setColor(Gfx.COLOR_LT_GRAY, Gfx.COLOR_TRANSPARENT);
            dc.drawText(x, y, $.fontTime, "88:88", Gfx.TEXT_JUSTIFY_CENTER);
    
            dc.setColor(Gfx.COLOR_BLUE, Gfx.COLOR_TRANSPARENT);
            dc.drawText(x, y, $.fontTime, time , Gfx.TEXT_JUSTIFY_CENTER);
    		
    		 	
      	} 

    This doesn't work for me, so do I have to draw a special clock font?

  • dc.setColor(Gfx.COLOR_LT_GRAY, Gfx.COLOR_TRANSPARENT);
    dc.drawText(x, y, $.fontTime, "88:88", Gfx.TEXT_JUSTIFY_CENTER);

    dc.setColor(Gfx.COLOR_LT_BLUE, Gfx.COLOR_TRANSPARENT);
    dc.drawText(x, y, $.fontTime, time , Gfx.TEXT_JUSTIFY_CENTER);

    But you'll also need to account for the leading zero on the hour. Either add it in line 6 or make sure you move the 2nd draw. Or position the draws to the right...

  • How do i make introductory zero an hour ago, i don't understand? Isn't it enough to just scroll the font?

  • ah, actually you seem to have another problem: you need to make sure you use a fixed-width font (every glyph (character) should have the same widht) From what I see it's 19:55 so the problem is not because of the missing leading 0, but because "1" is narrower than "8"

    After that you'll still have a few hours until midnight to fix the leading 0 ;)
    hint: the way to do is in line 6