Skip to content

Instantly share code, notes, and snippets.

Avatar
🍍

ShikiSuen ShikiSuen

🍍
View GitHub Profile
@ShikiSuen
ShikiSuen / 1000-applefontexperience.conf
Last active March 10, 2023 19:27
Apple Font Experience for Linux. You need to put this conf file in "/etc/fonts/conf.d" and manually install "Inter" and "Sarasa Gothic" to "/etc/fonts/opentype/". You can install PingFang if you wish. Install "noto-cjk" package from your Linux package manager for Noto Serif CJK support.
View 1000-applefontexperience.conf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- -->
<fontconfig>
<!-- Basic CJK Font Fallback Rule Redifined -->
<match target="pattern">
<test qual="any" name="lang" compare="contains">
<string>zh-TW</string>
</test>
<test qual="any" name="lang" compare="contains">
@ShikiSuen
ShikiSuen / DateChecker.swift
Created February 7, 2023 02:45
Swift Date Checker.
View DateChecker.swift
// (c) 2021 and onwards The vChewing Project (MIT License).
// ====================
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
import Foundation
extension Date {
/// Check whether current date is the given date.
/// - Parameter dateDigits: `yyyyMMdd`, 8-digit integer. If only `MMdd`, then the year will be the current year.
/// - Returns: The result. Will return false if the given dateDigits is invalid.
@ShikiSuen
ShikiSuen / IndexRevolver.swift
Last active January 30, 2023 17:09
Swift Index Revolver (requiring Swift 5.6)
View IndexRevolver.swift
// (c) 2021 and onwards Shiki Suen (MIT-NTL License).
// ====================
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
import Foundation
extension Collection {
public func revolvedIndex(_ id: Int, clockwise: Bool = true, steps: Int = 1) -> Int {
if id < 0 || steps < 1 { return id }
var result = id
@ShikiSuen
ShikiSuen / Shiki-FireFoxColorScheme-Blue
Created January 24, 2023 01:49
My FireFox Color Scheme (Blue).
View Shiki-FireFoxColorScheme-Blue
https://color.firefox.com/?theme=XQAAAAI-AQAAAAAAAABBqYhm849SCia3ftKEGccwS-xMDPr6gDamZHzRz3dFizlpUiReI-ZYiVK7inbKG9IGfUXu3jVRc6G6zvK1-1UfOf9mrr61QUHM5CaWkYaFS6IMLnm3QsyFX3dZdTUDdL5lmuT5zdXjOleYTsOGAU0EXgAyxw3wZKJPFmvHoVVnboNnApdnvcVAi7SmhiLL7-_3cIxJ9Asi4DcXVuA1IbqAcseCwQjErAPJlf_IBgzhzgkiKVOh569iOREGs-llTl2B0wOkPA04AfQB5Ocz7j5MSbZqixf7u2Sw
@ShikiSuen
ShikiSuen / IMKSuggestion.md
Last active November 9, 2022 06:12
Let's talk about what InputMethodKits needs to improve.
View IMKSuggestion.md

Related sample project: https://github.com/vChewing/vChewing-macOS/tree/f6271bbf50a2c377d9c2095d0f31f1492a653aef

It seems that individual bug reports doesn't work at all. Besides, the entire InputMethodKit needs a renovation.

This thread will be sent to Apple by certain special approaches after gathering enough usable information.

Let's talk about what InputMethodKits needs to improve. Here's my conclusion. If Apple think there's already an API, then it might be either mulfunctioning or not exposed to Swift.

  1. An official Swift-friendly wrapper with neither "!" nor "?" in the parameters of all provided APIs.
@ShikiSuen
ShikiSuen / FB10978412App.swift
Created September 20, 2022 10:00
FB10978412 Demo App (SwiftUI)
View FB10978412App.swift
/// FB10978412: Since macOS 11 Big Sur, CTFontCreateUIFontForLanguage cannot
/// distinguish zh-Hans and zh-Hant with correct adoptation of proper PingFang SC/TC variants.
import SwiftUI
@main
struct FB10978412App: App {
var body: some Scene {
WindowGroup {
ContentView()
@ShikiSuen
ShikiSuen / kaiu-name.ttx
Created September 16, 2022 03:49
The name table of the Kaiu.font on Windows 10.
View kaiu-name.ttx
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="4.28">
<name>
<namerecord nameID="0" platformID="1" platEncID="0" langID="0x0" unicode="True">
(c) Copyright DynaLab Inc. 1992-1998
</namerecord>
<namerecord nameID="1" platformID="1" platEncID="0" langID="0x0" unicode="True">
DFKai-SB
</namerecord>
@ShikiSuen
ShikiSuen / A-OVMANDARIN-UNITTEST.MD
Last active June 17, 2022 04:56
針對小麥 2.3 內建的 OVMandarin 的倚天26與許氏鍵盤的單元測試。
View A-OVMANDARIN-UNITTEST.MD

該測試為窮極測試,測試盡可能所有的在理論上能用倚天26與許氏鍵盤輸入的注音組合。

在執行此測試之前,請在 Mandarin.h 的接近檔案末尾的位置新增如下圖選中區域的內容:

image

也就是在 BopomofoReadingBuffer 的 public 段新增:

  std::string cnvSequence(std::string givenSequence) {
 clear();
@ShikiSuen
ShikiSuen / listCarbonKeyboardLayouts.swift
Last active April 8, 2022 14:17
Enumerate all available ASCII Carbon Keyboard Layouts.
View listCarbonKeyboardLayouts.swift
// Copyright (c) 2011 and onwards The OpenVanilla Project (MIT License).
// All possible vChewing-specific modifications are of:
// (c) 2021 and onwards The vChewing Project (MIT-NTL License).
/*
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
View IL POEMA DI ATENA vol.01 PR.md