Scratch3.0 secondary development (4) modify the interface font size

Problem: Chinese characters are too small

Many people have still raised this issue. The official native Scratch offline version is not friendly to old monitors. The fonts are too small and cannot be adjusted. Scratch2 still has a way to adjust the size, but Scratch3 can only be detoured, such as changing to Scratch2, using the online version, or adjusting the resolution of the monitor, and the effects are relatively uncomfortable.
Insert image description here
The initial starting point for my secondary development is to address this problem and make the words larger, otherwise it will be too hard for children’s eyes. We have enlarged the font by 30%
Insert image description here
If you do not meet the conditions for secondary development, you can also use my modified version directly. The download address is at the end of the article.

Let's do it

Speaking of this modification, there is no technical content, in fact it is relatively watery. Just modify the value of font-size in CSS. If you want to change the font, then change it again, The value of font-family, if you want to change the font weight, change the value of font-weight .

The problem is that the Scratch3 source code is modular, and each module has its own CSS. Finding it manually would be too much work, and there will inevitably be omissions.

Then just search and replace, it will be done in minutes.
Insert image description here
As for the unit of font size above, you can write a separate article. If you want to know more, you should search it yourself. There is already a lot of ready-made information.

A fish that slipped through the net

After modification, you will find that the fonts in some places have not changed, such as the building blocks. The reason is that this brother's code is not in scratch-gui. Let’s solve this problem

Addressing building block font size

Source code address: https://github.com/LLK/scratch-blocks

The unit of font size in scratch-blocks is pt. I tried 14pt which is OK.
Code modification is very simple, just search and replace.

Compilation issues with scratch-blocks

When compiling scratch-blocks, I found a special feature, that is, it could not be compiled under Windows. Even after changing various node.js versions and python versions, it still failed. Finally, I changed to Linux to get it done.

Wouldn’t it be interesting to have to change the system to do something like this? Install a virtual machine? NO! Just install Ubuntu in the Win10 app store
Insert image description here
This Ubuntu can also directly access files on the hard disk, which is much more convenient than a virtual machine.
I won’t go into details about the installation and use of node.js on Linux. The method is similar to that of Win10. If you need it, you can check out my previous blog posts.

Because it is not possible to link directly, after compilation, you need to copy the compilation results to scratch-gui-develop\node_modules\scratch-blocks\.

other

If you find that the font size is too small, you can fine-tune it one by one. The element positioning of the Chrome browser can help find the location of the code. Give a chestnut:
Insert image description here

Download

As mentioned above, friends who do not have the conditions for secondary development can download and use the offline version I modified.
Download address:
https://download.csdn.net/download/svyee/12423467
https://download .csdn.net/download/svyee/13122570
If you don’t have CSDN points, then leave your email address in the message area. You can add penguin group 472478416 and get it from the group sharing.

[2022.09.14] A version has been updated, the download address is inanother blog post [here], no need to leave a message.

That’s all for today, bye~

Guess you like

Origin blog.csdn.net/svyee/article/details/106120616
Recommended