Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. The text is blurry
Forum Updated to NodeBB v4.3 + New Features

The text is blurry

Scheduled Pinned Locked Moved Solved Qt for WebAssembly
5 Posts 2 Posters 811 Views
  • 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.
  • GaoboG Offline
    GaoboG Offline
    Gaobo
    wrote on last edited by
    #1

    Hi, when I compiler the application by emcc, I found that the text is blurry,
    03fdad9b-54d8-4db7-af69-460663961385-image.png

    but when I change the brower's scaled ratio to 200%, it become clear. why?
    0fdbf81f-fcb7-4be9-9b52-7c17de21dda1-image.png

    and how to make the text clear ?

    1 Reply Last reply
    0
    • GaoboG Offline
      GaoboG Offline
      Gaobo
      wrote on last edited by
      #2

      I solved this problem,.
      The qt webAssembly don't have font, if we want to use chinese character, we need to pack the font file, the add to the application's font.
      and we need to set the font hint preference, otherwise the font become blurry.

          int fontId = QFontDatabase::addApplicationFont(QStringLiteral(":/font/msyh.ttc"));
          QStringList fontFamilies = QFontDatabase::applicationFontFamilies(fontId);
          if (fontFamilies.size() > 0)
          {
              QFont font;
              font.setFamily(fontFamilies[0]);//设置全局字体
              font.setHintingPreference(QFont::PreferFullHinting);
              QApplication::setFont(font);
          }
      
      1 Reply Last reply
      1
      • GaoboG Gaobo has marked this topic as solved on
      • JasonWongJ Offline
        JasonWongJ Offline
        JasonWong
        wrote on last edited by JasonWong
        #3

        @Gaobo said in The text is blurry:

        QFont::PreferFullHinting

        Is QFont::PreferFullHinting a necessary setting? I tested it. After modifying the settings, some words were cleared and some words were blurred.

        The most obvious ones are "唐" and "像"

        1.png
        2.png

        1 Reply Last reply
        1
        • JasonWongJ Offline
          JasonWongJ Offline
          JasonWong
          wrote on last edited by
          #4

          I also tested some other Chinese texts, and I can’t tell which version is better.

          4.png
          3.png

          GaoboG 1 Reply Last reply
          0
          • JasonWongJ JasonWong

            I also tested some other Chinese texts, and I can’t tell which version is better.

            4.png
            3.png

            GaoboG Offline
            GaoboG Offline
            Gaobo
            wrote on last edited by
            #5

            @JasonWong
            I have not found which option is the best, maybe we need to make a choice.
            Select the most clear option to use.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved