Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved TTF Font in CSS laden

    German
    2
    7
    396
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      Dany last edited by

      Hi!

      Wie lädt man denn einen Font über CSS nach, um den dann in den StyleSheets zu verwenden?

      raven-worx 1 Reply Last reply Reply Quote 0
      • raven-worx
        raven-worx Moderators @Dany last edited by

        @Dany
        Qt Stylesheets != CSS
        => gar nicht

        Fonts müssen entweder im System bereits installiert sein, oder dynamisch via QFontDatabase::addApplicationFont()

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply Reply Quote 0
        • D
          Dany last edited by

          Das erklärt so einiges ;).

          Und wenn ich das richtig gesehen habe, kann ich nicht einmal einen TTF-Font einfach laden und verwenden. Der muss bei Linux schon installiert sein. Liege ich da richtig?

          raven-worx 1 Reply Last reply Reply Quote 0
          • raven-worx
            raven-worx Moderators @Dany last edited by

            @Dany
            ja, wie ich gesagt habe.
            oder du packst in in ein qrc und verwendest QFontDatabase

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply Reply Quote 0
            • D
              Dany last edited by

              Okay. Ich bin jetzt noch neu was qrc angeht, finde es aber jetzt schon spannend. Falls man da auch Librarys mit einbauen könnte, wäre das eine super bequeme Angelegenheit!

              Aber zurück zum Thema.

              <!DOCTYPE RCC><RCC version="1.0">
              <qresource>
                  <file>fonts/EmojiOneFont.ttf</file>
              </qresource>
              </RCC>
              

              So sieht meine font.qrc aus. Im Verzeichnis fonts liegt auch die Datei. Ich hab es in CMake als Source-File eingebunden, AUTORCC steht auf ON, es kommen auch beim compilieren keinerlei Fehler.

              In meinem MainWindow sieht es so aus:

                  QFontDatabase::addApplicationFont(":/fonts/EmojiOneFont.ttf");
              
                  QFontDatabase db;
                  for(int i=0; i<db.families().size(); i++)
                  {
                      qDebug() << db.families().at(i);
                  }
              

              EmojiOneFont taucht da aber nicht auf. Also mache ich ja noch irgendwo irgendwas falsch. :/EmojiOneFont.ttf tut es übrigens auch nicht.

              raven-worx 1 Reply Last reply Reply Quote 0
              • raven-worx
                raven-worx Moderators @Dany last edited by raven-worx

                @Dany
                is es der emoji font colored? Wenn ja wird es nicht funktionieren.
                siehe auch: https://github.com/googlefonts/noto-emoji/issues/36

                Emojis dürften gerade ziemlich interessant sein :)
                Eine alternative von mir die auf grafiken aufbaut: https://forum.qt.io/topic/123515/qrwemoticons

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                1 Reply Last reply Reply Quote 0
                • D
                  Dany last edited by

                  @raven-worx
                  Die Idee mit deinem Projekt finde ich ja schon irgendwie viel versprechen. Läuft das auch unter Windows?

                  Finde es schon irgendwie fies. Unter Windows kommen auch bei Unicode direkt farbige Emojis.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post