Use otf/ tff for font in WinUI

youki 1,021 Reputation points
2022-06-17T19:29:57.743+00:00

Is it possible to use these files for fonts in C++.
I've tried the c# examples but it doesn't seem to work?!

https://stackoverflow.com/questions/70371593/how-do-i-change-the-default-font-of-my-winui-application

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
804 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,806 questions
0 comments No comments
{count} votes

Accepted answer
  1. Castorix31 86,406 Reputation points
    2022-06-17T20:22:37.957+00:00

    This works for me with a random .ttf :
    In App.xaml :

     <FontFamily x:Key="ContentControlThemeFontFamily">/Assets/Quirlycues.ttf#Quirlycues</FontFamily>  
    

    Result : the default font is changed on controls with Quirlycues font=>

    212575-customfont.jpg


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.