List of commits:
Subject Hash Author Date (UTC)
Fix font kerning support ab4cbabbed82f629d616f8878790e7d2666524eb mse 2021-10-02 21:10:14
Add default soundspec volume 82a658f2e2bd786618228346bc1848c1be894054 mse 2021-09-30 05:23:43
Fix Windows build and update SDL d8f30e756bc4d5a63e5b7524db2b69ae5af4f88f mse 2021-09-29 23:31:25
Update gamecontrollerdb 3da6ad2629e0b28cad34b3ff7a89c0fe0d96a2fd mse 2021-09-29 23:02:39
Parse newline escape sequences in caption ff33cfb3e88098ae24a6afa1cc7ac9049b6e4c1f mse 2021-09-27 23:45:58
Fix loadOBJ(...) 0b307ff98c2aa8f79d62770b3e2aff6fb7d8670a mse 2021-09-25 05:18:15
Add uploadModelTransforms(...) 53530b8cabe72cfa6c71148bd484a1b5a17df565 mse 2021-09-23 14:33:47
Readability a5885db68a6134c7c3930b6cf10650f0b340088d mse 2021-09-13 15:56:30
Pad HUD health with 0 267304751e17901c276108d8899d096e2094cb2a mse 2021-09-13 11:02:57
Housekeeping 6ff79e3a21829e267e866a8472777e180d337ff4 mse 2021-09-13 07:33:00
Add CSL comments 7a818e8b57cb38c9bfef922e66bd6f735b4962e4 mse 2021-09-12 09:26:07
Add Confectioner Scripting Language (CSL) & change array separator to ; 8d980bfac5d649574f749b7c04a19af766f71091 mse 2021-09-11 12:31:58
Fix console /set bug 7c45e27e7f40472bea317b0316e4367135b49704 mse 2021-09-11 01:32:11
Scriptable lines@, ids@, bugfix 9f606fd2a793fd76a9d1b9e186434d231b973085 mse 2021-09-10 14:43:50
Add array scripting (@ operator, ARRLEN <array>) 3f098b3e0a04922c2c7a981b232efd8d08a8d9a0 mse 2021-09-10 14:02:39
Optimize script runtime a298b01c9b77192b7ed8aba3832a8ab51c9d389a mse 2021-09-09 06:57:49
Scriptable bg$, fg$, caption$ 0ad08aa3887118d2376f4fa7f8b7c66e0f164c73 mse 2021-09-06 11:04:38
Animation command: ANIM <loop|play> <bg|fg> <fps> <directory> 6066e2cae1dc29043902d46549f443c7b683fd88 mse 2021-09-06 06:42:13
Switch to C++17 489987b1b2749f37e0ac76594308635affbd24f2 mse 2021-09-05 10:51:02
Fix stats synchronization bug 3b6195c3321a6f10af43839cc00d24f301eddb3e mse 2021-09-05 04:45:58
Commit ab4cbabbed82f629d616f8878790e7d2666524eb - Fix font kerning support
Author: mse
Author date (UTC): 2021-10-02 21:10
Committer name: mse
Committer date (UTC): 2021-10-02 21:10
Parent(s): 82a658f2e2bd786618228346bc1848c1be894054
Signing key:
Tree: eadc5f0583c2791616f5091328ea70ddd77d5bb1
File Lines added Lines deleted
include/fg2/fg2.h 4 2
include/fg3/fg3.h 4 2
File include/fg2/fg2.h changed (mode: 100755) (index 3b04ebc..acfc2b3)
... ... Font loadFont( std::string fileName, float fontSize, int oversampleX, int oversa
2398 2398 float getTextWidthUtf32( std::u32string codepoints, Font &font ){ float getTextWidthUtf32( std::u32string codepoints, Font &font ){
2399 2399 Texture &tex = font.texture; Texture &tex = font.texture;
2400 2400 if( !tex.success ) return 0.0f; if( !tex.success ) return 0.0f;
2401 float kernScale = stbtt_ScaleForPixelHeight( &font.info, font.height );
2401 2402 // for stb_truetype's automatic positioning // for stb_truetype's automatic positioning
2402 2403 float charX = 0.0f, charY = 0.0f; float charX = 0.0f, charY = 0.0f;
2403 2404 for( size_t i = 0; i < codepoints.length(); i++ ){ for( size_t i = 0; i < codepoints.length(); i++ ){
 
... ... float getTextWidthUtf32( std::u32string codepoints, Font &font ){
2408 2409 stbtt_GetPackedQuad( font.packedChars.data(), tex.width, tex.height, ci, &charX, &charY, &q, 0 ); stbtt_GetPackedQuad( font.packedChars.data(), tex.width, tex.height, ci, &charX, &charY, &q, 0 );
2409 2410 // set the kern offset for the next character // set the kern offset for the next character
2410 2411 if( codepoints.length() - i > 1 ) if( codepoints.length() - i > 1 )
2411 charX += ( q.s1 - q.s0 ) * stbtt_GetCodepointKernAdvance( &font.info, cp, codepoints[ i + 1 ] );
2412 charX += stbtt_GetCodepointKernAdvance( &font.info, cp, codepoints[ i + 1 ] ) * kernScale;
2412 2413 } }
2413 2414 return charX; return charX;
2414 2415 } }
 
... ... void drawTextUtf32( std::u32string codepoints, Font &font, float posX, float pos
2427 2428 float leading = font.size * 1.2f; float leading = font.size * 1.2f;
2428 2429 size_t wordStart = 0; size_t wordStart = 0;
2429 2430 float wordStartX = 0.0f; float wordStartX = 0.0f;
2431 float kernScale = stbtt_ScaleForPixelHeight( &font.info, font.height );
2430 2432
2431 2433 // for stb_truetype's automatic positioning // for stb_truetype's automatic positioning
2432 2434 float charX = 0.0f, charY = 0.0f; float charX = 0.0f, charY = 0.0f;
 
... ... void drawTextUtf32( std::u32string codepoints, Font &font, float posX, float pos
2447 2449
2448 2450 // set the kern offset for the next character // set the kern offset for the next character
2449 2451 if( codepoints.length() - i > 1 ) if( codepoints.length() - i > 1 )
2450 charX += ( q.s1 - q.s0 ) * stbtt_GetCodepointKernAdvance( &font.info, cp, codepoints[ i + 1 ] );
2452 charX += stbtt_GetCodepointKernAdvance( &font.info, cp, codepoints[ i + 1 ] ) * kernScale;
2451 2453
2452 2454 // handle newlines and word wrapping // handle newlines and word wrapping
2453 2455 if( cp == ' ' ){ if( cp == ' ' ){
File include/fg3/fg3.h changed (mode: 100644) (index 07f2399..c8101da)
... ... Font loadFont( std::string fileName, float fontSize, int oversampleX, int oversa
2631 2631 float getTextWidthUtf32( std::u32string codepoints, Font &font ){ float getTextWidthUtf32( std::u32string codepoints, Font &font ){
2632 2632 Texture &tex = font.texture; Texture &tex = font.texture;
2633 2633 if( !tex.success ) return 0.0f; if( !tex.success ) return 0.0f;
2634 float kernScale = stbtt_ScaleForPixelHeight( &font.info, font.height );
2634 2635 // for stb_truetype's automatic positioning // for stb_truetype's automatic positioning
2635 2636 float charX = 0.0f, charY = 0.0f; float charX = 0.0f, charY = 0.0f;
2636 2637 for( size_t i = 0; i < codepoints.length(); i++ ){ for( size_t i = 0; i < codepoints.length(); i++ ){
 
... ... float getTextWidthUtf32( std::u32string codepoints, Font &font ){
2641 2642 stbtt_GetPackedQuad( font.packedChars.data(), tex.width, tex.height, ci, &charX, &charY, &q, 0 ); stbtt_GetPackedQuad( font.packedChars.data(), tex.width, tex.height, ci, &charX, &charY, &q, 0 );
2642 2643 // set the kern offset for the next character // set the kern offset for the next character
2643 2644 if( codepoints.length() - i > 1 ) if( codepoints.length() - i > 1 )
2644 charX += ( q.s1 - q.s0 ) * stbtt_GetCodepointKernAdvance( &font.info, cp, codepoints[ i + 1 ] );
2645 charX += stbtt_GetCodepointKernAdvance( &font.info, cp, codepoints[ i + 1 ] ) * kernScale;
2645 2646 } }
2646 2647 return charX; return charX;
2647 2648 } }
 
... ... void drawTextUtf32( std::u32string codepoints, Font &font, float posX, float pos
2660 2661 float leading = font.size * 1.2f; float leading = font.size * 1.2f;
2661 2662 size_t wordStart = 0; size_t wordStart = 0;
2662 2663 float wordStartX = 0.0f; float wordStartX = 0.0f;
2664 float kernScale = stbtt_ScaleForPixelHeight( &font.info, font.height );
2663 2665
2664 2666 // for stb_truetype's automatic positioning // for stb_truetype's automatic positioning
2665 2667 float charX = 0.0f, charY = 0.0f; float charX = 0.0f, charY = 0.0f;
 
... ... void drawTextUtf32( std::u32string codepoints, Font &font, float posX, float pos
2680 2682
2681 2683 // set the kern offset for the next character // set the kern offset for the next character
2682 2684 if( codepoints.length() - i > 1 ) if( codepoints.length() - i > 1 )
2683 charX += ( q.s1 - q.s0 ) * stbtt_GetCodepointKernAdvance( &font.info, cp, codepoints[ i + 1 ] );
2685 charX += stbtt_GetCodepointKernAdvance( &font.info, cp, codepoints[ i + 1 ] ) * kernScale;
2684 2686
2685 2687 // handle newlines and word wrapping // handle newlines and word wrapping
2686 2688 if( cp == ' ' ){ if( cp == ' ' ){
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/mse/ConfectionerEngine

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/mse/ConfectionerEngine

Clone this repository using git:
git clone git://git.rocketgit.com/user/mse/ConfectionerEngine

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin master