Skip to content

Instantly share code, notes, and snippets.

@Jamesits
Last active March 27, 2023 10:15
Show Gist options
  • Save Jamesits/6a58a1b08d5cd09a94a02f30ddaf0e13 to your computer and use it in GitHub Desktop.
Save Jamesits/6a58a1b08d5cd09a94a02f30ddaf0e13 to your computer and use it in GitHub Desktop.
My MacType profile, optimized for Telegram UWP and something else.
; Please see https://gist.github.com/Jamesits/6a58a1b08d5cd09a94a02f30ddaf0e13#gistcomment-2081294
; for instruction.
; Author: James Swineson <[email protected]>
[General]
Name=James Profile
; 【启用 DirectWrite 支持】
; [0:Disable] 1:Enable
DirectWrite=1
; 【自动挂钩子进程】
; [0:Disable] 1:Enable
HookChildProcesses=1
; 【字体微调】
; 0:NoHinting [1:Normal] 2:AutoHinting 3:Light+AutoHinting
HintingMode=1
; 【抗锯齿方式】
; -1:Disable 0:Normal 1:Light 2:LCD(RGB) 3:LCD(GBR) 4:Light-LCD(RGB) 5:Light-LCD(GBR)
AntiAliasMode=2
; 【常规体调整】
; -32:+32
NormalWeight=0
; 【粗体字的调整】
; -16:+16
BoldWeight=0
; 【斜体字的倾斜角度微调】
; -16:+16
ItalicSlant=0
; 【字体颜色深浅】
; -32:+32
Saturation=0
;【只有在FontLoader=0(在下面)时此项设置才有效。建议选0,选1会占用大量内存,也没看出有什么好处。】
; 0:Disable 1:Enable
UseMapping=0
; 【Gamma模式开关】
; -1:关闭;0:使用设置的Gamma值(GammaValue);1:使用sRGB的Gamma值;2:不明
GammaMode=1
;【Gamma值】
; GammaMode=0的时候此项设置才有效
; sRGB ≒ 2.2 CT-Default = 1.4
; windows的cleartype的Gamma值是1.4
; GammaValue=1.54
GammaValue = 2.2
; 【对比度】
; 数字越大越锐利,数字越小越发虚
Contrast=1.22
; 【字体轮廓】
; 数字越大字体就越粗越黑
RenderWeight=1.5
; 【文字边界设置】
; TextTuning是RGB三色全局设置,TextTuningR、TextTuningG、TextTuningB是单独设置RGB三色
TextTuning=0
; 数字越大越强调背景(类似文字边界被侵蚀的感觉),强调背景会有中字体锐利的感觉。适当降低对比度,提高TextTuning,可以使文字周围的颜色看起来“淡一点”
; 再加上RenderWeight,把这三个设置的微妙平衡调节好的话,能得到不输给Mac的效果
;TextTuningR=32
;TextTuningG=32
;TextTuningB=32
TextTuningR=0
TextTuningG=0
TextTuningB=0
; 【粗体字的渲染方法】
; 0:New 1:Old 2:Original FreeType Algorithm
; 0:使用gdi0440以后版本的渲染方式;
; 1:使用gdi0424以前版本的渲染方式;
; 2:使用gdi0347以前版本的渲染方式,也就是freetype本身的粗体渲染。
BolderMode=0
; 【字体的载入方法(注意是载入方法,不是渲染方法)】
; 0:FreeType 1:WIN32
; 0:用freetype载入字体
; 1:用windows的绘图核心载入字体
; 很多freetype的设置需要此项选0才能生效
FontLoader=0
; 【字体链接】
; 当FontLoader=0时
; 0:什么都不做;
; 1:使用注册表里的字体链接设置,通过FreeType的字符表进行查找
; 2:使用注册表里的字体链接设置,使用Windows的转换函数直接查找
; 当FontLoader=1时
; 会保持启用的状态,但是所有字体链接的处理会交由WIN32API完成。
FontLink=2
; 【字体替代】
; 0:Disable 1:ini Only 2:ini+Registry
; 当FontLoader=0时
; 0:什么都不做;
; 1:使用该设置文件最下面的设置;
; 2:该设置文件最下面的设置和注册表里的设置一起启用。
; 当FontLoader=1时
; 会保持启用的状态,但是所有字体替代的处理会交由WIN32API完成
FontSubstitutes=2
;【让freetype处理的最大的字体尺寸,单位是像素,0的话就是全尺寸】
; 交付 gdi++ 处理的最大尺寸(单位为像素)
; 0-2147483647
MaxHeight=0
; 【阴影设置】
; 格式:水平偏移,垂直偏移,阴影深度(值越大,越浅)
;Shadow=1,1,10
; 【液晶显示器的优化配置】
; [0:None] 1:Default 2:Light 16:Legacy
LcdFilter=2
; 【字体缓存、内存的设置】
LoadOnDemand=1
CacheMaxFaces=640
CacheMaxSizes=64000
CacheMaxBytes=52428800
HingtingMode=1
;强制对小字体使用Hinting,使小字体更清晰。此参数仅在AntiAliasMode=1、4、5时有效。1=开启,0=关闭,默认开启
HintSmallFont=0
EnableKerning=0
; 【强制使用某一个字体】
; 无视所有其他字体,全系统的字体都会被这里设置的字体代替
;ForceChangeFont=华文中宋
[DirectWrite]
;0 = DWRITE_RENDERING_MODE_DEFAULT
; Specifies that the rendering mode is determined automatically based on the font and size.
;1 = DWRITE_RENDERING_MODE_ALIASED
; Specifies that no antialiasing is performed. Each pixel is either set to the foreground
; color of the text or retains the color of the background.
;2 = DWRITE_RENDERING_MODE_GDI_CLASSIC
; Specifies that antialiasing is performed in the horizontal direction and the appearance
; of glyphs is layout-compatible with GDI using CLEARTYPE_QUALITY. Use DWRITE_MEASURING_MODE_GDI_CLASSIC
; to get glyph advances. The antialiasing may be either ClearType or grayscale depending on
; the text antialiasing mode.
;3 = DWRITE_RENDERING_MODE_GDI_NATURAL
; Specifies that antialiasing is performed in the horizontal direction and the appearance
; of glyphs is layout-compatible with GDI using CLEARTYPE_NATURAL_QUALITY. Glyph advances
; are close to the font design advances, but are still rounded to whole pixels. Use
; DWRITE_MEASURING_MODE_GDI_NATURAL to get glyph advances. The antialiasing may be either
; ClearType or grayscale depending on the text antialiasing mode.
;4 = DWRITE_RENDERING_MODE_NATURAL
; Specifies that antialiasing is performed in the horizontal direction. This rendering
; mode allows glyphs to be positioned with subpixel precision and is therefore suitable
; for natural (i.e., resolution-independent) layout. The antialiasing may be either
; ClearType or grayscale depending on the text antialiasing mode.
;5 = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC
; Similar to natural mode except that antialiasing is performed in both the horizontal
; and vertical directions. This is typically used at larger sizes to make curves and
; diagonal lines look smoother. The antialiasing may be either ClearType or grayscale
; depending on the text antialiasing mode.
;6 = DWRITE_RENDERING_MODE_OUTLINE
; Specifies that rendering should bypass the rasterizer and use the outlines directly.
; This is typically used at very large sizes.
RenderingMode=5
;This setting enhances the edge of font
;if you tune it too high, you will get a colored edge.
;if you tune it too low, the font will become blurry.
;Min: 0.0625
;Max: 10.0
Contrast=1
;Determine the degree directwrite applies anti-alias to the font outline.
;Min: 0
;Max: 1.0
ClearTypeLevel=1.0
;For DirectWrite, if it is undefined, the gammavalue will be calculated automatically
;with respect to the gammavalue in General Section.
GammaValue=2.2
[Individual]
; 【单独设置的字体】
; 格式=Hinting, AAMode, NormalWeight, BoldWeight, ItalicSlant, Kerning
; 如使用默认宋体的,请去掉下面两行的注释
[Exclude]
; 【除外的字体】
System
Fixedsys
[ExcludeModule]
; 【除外的程序】
[ExcludeSub]
; 不替换字体的程序
powershell_ise.exe
devenv.exe
Code.exe
[UnloadDll]
; Java programs
arduino.exe
idea.exe
java.exe
javaw.exe
javaws.exe
matlab.exe
pycharm64.exe
pycharm.exe
;
; Games
; Blizzard
Agent.exe
; Valve
cstrike.exe
; MS
forzahorizon4.exe
; miHoYo
BH3.exe
YuanShen.exe
GenshinImpact.exe
;
; ConEmu
ConEmuC.exe
ConEmuC64.exe
;
; Adobe
Photoshop.exe
Illustrator.exe
;
; Realtek
RTHDCPL.exe
RtHDVCpl.exe
; Other special programs
;
CppIDE.exe
DXG.exe
GoogleUpdate.exe
xdict.exe
winbox.exe
;
; Windows
GamePanel.exe
rundll32.exe
audiodg.exe
ccApp.exe
conhost.exe
conime.exe
csrss.exe
ctfmon.exe
dllhost.exe
dwm.exe
explorer.exe
fontview.exe
hpgs2wnf.exe
imejpmgr.exe
jqs.exe
jusched.exe
lsass.exe
lsm.exe
mdm.exe
mencoder.exe
mmc.exe
msdev.exe
nvsvc32.exe
nvvsvc.exe
oobechk.exe
scardsvr.exe
SearchFilterHost.exe
searchindexer.exe
SearchProtocolHost.exe
services.exe
smss.exe
spoolsv.exe
svchost.exe
taskeng.exe
taskhost.exe
unsecapp.exe
userinit.exe
winbox.exe
wininit.exe
winlogon.exe
wmdc.exe
wmiprvse.exe
wmpnetwk.exe
wscntfy.exe
wudfhost.exe
MicrosoftEdge.exe
MicrosoftEdgeCP.exe
MicrosoftEdgeSH.exe
; Office https://bbs.saraba1st.com/2b/thread-1981475-0-1.html
OfficeC2RClient.exe
SppExtComObj.exe
[FontSubstitutes]
; 【字体替代】
; 系统在调用“=”前面的字体时会忽视“=”前面的字体,而去直接调用“=”后面的字体
; 如希望使用默认宋体的,请将下面三行注释掉
宋体=Microsoft Yahei UI
SimSun-ExtB=Microsoft Yahei UI
MS Serif=Arial
MS Sans Serif=Segoe UI
Microsoft Sans Serif=Segoe UI
Open Sans Regular=Segoe UI
Open Sans Semibold=Segoe UI Semibold
SimSun=Microsoft Yahei UI
NSimSun=Microsoft Yahei UI
新宋体=Microsoft Yahei UI
MS PGothic=Microsoft Yahei UI
MS UI Gothic=Microsoft Yahei UI
Arial Unicode MS=Microsoft Yahei UI
Yu Gothic UI=Microsoft Yahei UI
Yu Gothic=Microsoft Yahei UI
Microsoft JhengHei=Microsoft Yahei UI
Microsoft JhengHei UI=Microsoft Yahei UI
Microsoft MHei=Microsoft Yahei UI
MingLiU=Microsoft Yahei UI
PMingLiU=Microsoft Yahei UI
Microsoft NeoGothic=Microsoft Yahei UI
Malgun Gothic=Microsoft Yahei UI
Dotum=Microsoft Yahei UI
Gulim=Microsoft Yahei UI
Yu Gothic Light=Microsoft Yahei UI
Yu Gothic Medium=Microsoft Yahei UI
Yu Gothic UI Semilight=Microsoft Yahei UI
Yu Gothic UI Semibold=Microsoft Yahei UI
; Chrome specific rules
[FontSubstitutes@ChromeSpec]
Microsoft Yahei=Source Han Sans
Microsoft Yahei UI=Source Han Sans
[[email protected]]
Alternative=ChromeSpec
@Jamesits
Copy link
Author

Jamesits commented May 2, 2017

Usage

  1. Download and install the latest MacType release (20170614 or later). If you are upgrading, reboot after installation finished.
  2. Put my ini file into ini folder under MacType installation folder.
  3. Install Source Han Sans. (Do not use SuperOTC since Windows support of it is buggy for now.)
  4. Launch MacType, enable James Profile. Then you are good to go. For some applications (Telegram, for example) MacType need to be launched before it starts.

Features

  • Based on LCD.W7.默认字体.仿Mac profile and @hjc4869 's Telegram optimization
  • Optimized for Chinese users using English (United States) locale
  • Optimized for Telegram Desktop (and UWP version)
  • Works under Chrome (newest stable channel)
  • Tested under newest stable version of Windows 10 1703

Screenshots

Telegram UWP

If you see mixed strange font in Telegram, this may be a bug; ensure MacType is started at boot (earlier than Telegram) then sign out & in Windows again.
Telegram UWP

MMC

MMC

Chrome

Chrome have DirectWrite bugs; your mileage may vary. I recommend using Advanced Font Settings plugin to change default font to Source Han Sans.
Chrome

Explorer

Explorer

Updates

  • 2018-05-23
    • exclude explorer.exe to prevent crash on 16299.431
  • 2017-07-09
    • Substitute Microsoft YaHei to Source Han Sans under Chrome to work around strange DirectWrite rendering of MS YaHei.
    • So Source Han Sans is now a dependency.
  • 2017-06-16
    • Random crash seems to be resolved after release 20170614.
  • 2017-05-10
    • Exclude 010 Editor to avoid crash
  • 2017-05-02
    • Emptying recycle bin will not cause explorer crash again.
    • Using IME in some applications (WinBox, WinMTR, etc) will not cause explorer crash again.

@jorismq
Copy link

jorismq commented Nov 9, 2017

一个bug。下载了你的ini,用最新版2017.628加载了以后,很多效果没有,例如字体加粗,阴影什么的。但是,神奇的是,我把ini里面的;开头的注释语句全部删除了以后居然可以了!!!
什么问题??

@kkren
Copy link

kkren commented Feb 11, 2019

从 gist 上下载文件似乎会用 UTF-8 保存,但是 mactype 识别的是 gb18030 编码,需要自己转换一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment