Skip to content

Commit c716f98

Browse files
committed
2 parents 2809d82 + c49c29b commit c716f98

3 files changed

Lines changed: 85 additions & 26 deletions

File tree

Sources/DKSTHangul.m

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ @interface DKSTHangul () {
1313
NSMutableString *_buffer;
1414
NSMutableString *_completed;
1515
}
16+
17+
// Old Hangul Choseongs
18+
#define CHOSEONG_YESIEUNG 0x114C // Yesieung (ㆁ)
19+
#define CHOSEONG_SSANGIEUNG 0x1147 // SsangIeung (ㆀ) - Shift+D
20+
#define CHOSEONG_PANSIOT 0x1140 // Bansiot (ㅿ)
21+
#define CHOSEONG_YEORINHIEUH 0x1159 // Yeorinhieuh (ㆆ)
22+
#define CHOSEONG_KAPYEOUNPHIEUP 0x1157 // KapyeounPhieup (ㆄ)
23+
#define CHOSEONG_SG 0x112D // Sios-Kiyeok (ㅺ)
24+
#define CHOSEONG_BS 0x112F // Sios-Tikeut (ㅼ)
25+
#define CHOSEONG_BJ 0x1132 // Sios-Pieup (ㅽ)
26+
27+
// Old Hangul Jungseongs
28+
#define JUNGSEONG_ARAEAE 0x11A1
29+
1630
@end
1731

1832
@implementation DKSTHangul
@@ -71,11 +85,18 @@ - (NSString *)commitString {
7185
}
7286

7387
// Check types
74-
- (BOOL)isCho:(unichar)c { return c >= 0x1100 && c <= 0x1112; }
75-
- (BOOL)isJung:(unichar)c { return (c >= 0x1161 && c <= 0x1175) || (c == 0x119E); }
76-
- (BOOL)isJong:(unichar)c { return (c >= 0x11A8 && c <= 0x11C2); }
88+
// Updated ranges for Old Hangul
89+
- (BOOL)isCho:(unichar)c { return (c >= 0x1100 && c <= 0x115F); } // Expanded
90+
- (BOOL)isJung:(unichar)c { return (c >= 0x1161 && c <= 0x11A7); } // Expanded
91+
- (BOOL)isJong:(unichar)c { return (c >= 0x11A8 && c <= 0x11FF); } // Expanded
7792

7893
- (unichar)mapFromChar:(unichar)c {
94+
// Old Hangul Overrides for Shift+D/Shift+G
95+
if (self.oldHangulEnabled) {
96+
if (c == 'D') return CHOSEONG_SSANGIEUNG; //
97+
if (c == 'G') return CHOSEONG_KAPYEOUNPHIEUP; //
98+
}
99+
79100
switch(c) {
80101
case 'q': return 0x1107; case 'Q': return 0x1108; // ㅂ, ㅃ
81102
case 'w': return 0x110c; case 'W': return 0x110d; // ㅈ, ㅉ
@@ -110,6 +131,28 @@ - (unichar)mapFromChar:(unichar)c {
110131
return 0;
111132
}
112133

134+
- (unichar)combineCho:(unichar)a second:(unichar)b {
135+
if (!self.oldHangulEnabled) return 0;
136+
137+
// ㅇ + ㅇ = ㆁ (Yesieung)
138+
if (a == 0x110B && b == 0x110B) return CHOSEONG_YESIEUNG;
139+
// ㅅ + ㅅ = ㅿ (Bansiot)
140+
if (a == 0x1109 && b == 0x1109) return CHOSEONG_PANSIOT;
141+
// ㅎ + ㅎ = ㆆ (Yeorinhieuh)
142+
if (a == 0x1112 && b == 0x1112) return CHOSEONG_YEORINHIEUH;
143+
144+
// ㄱ + ㅅ = ㅺ (Sg)
145+
if (a == 0x1100 && b == 0x1109) return CHOSEONG_SG;
146+
// ㅂ + ㅅ = ㅼ (Bs)
147+
if (a == 0x1107 && b == 0x1109) return CHOSEONG_BS;
148+
// ㅂ + ㅈ = ㅽ (Bj)
149+
if (a == 0x1107 && b == 0x110C) return CHOSEONG_BJ;
150+
151+
return 0;
152+
}
153+
154+
155+
113156
- (unichar)currentSyllable {
114157
if (_cho == 0 && _jung == 0 && _jong == 0) return 0;
115158

@@ -248,9 +291,15 @@ - (BOOL)processCode:(NSInteger)keyCode modifiers:(NSUInteger)flags
248291
// State: Cho only or Empty
249292
if (_cho == 0) { _cho = hangul; }
250293
else {
251-
// Flush prev Cho, start new
252-
[_completed appendFormat:@"%C", [self compatibilityJamo:_cho]];
253-
_cho = hangul;
294+
// Try Combine Cho (Old Hangul)
295+
unichar compound = [self combineCho:_cho second:hangul];
296+
if (compound) {
297+
_cho = compound;
298+
} else {
299+
// Flush prev Cho, start new
300+
[_completed appendFormat:@"%C", [self compatibilityJamo:_cho]];
301+
_cho = hangul;
302+
}
254303
}
255304
} else {
256305
// Already have Jung.
@@ -273,7 +322,10 @@ - (BOOL)processCode:(NSInteger)keyCode modifiers:(NSUInteger)flags
273322
if (asJong) {
274323
_jong = asJong;
275324
} else {
276-
// Start new syllable
325+
// Not a valid Jongseong. Maybe combined Cho (Old Hangul)?
326+
// But we already have Jung, so it's a new Syllable unless Old Hangul allows Cho+Jung+Cho?
327+
// No, Cho+Jung+Cho structure isn't standard. It must be Jongseong or new Syllable.
328+
// If it's not a valid Jongseong, it's a new syllable.
277329
[self flush];
278330
_cho = hangul; _jung = 0; _jong = 0;
279331
}

Sources/InputController.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ - (BOOL)handleEvent:(NSEvent *)event client:(id)sender {
142142
default: break;
143143
}
144144

145+
// Old Hangul Bypass for 'd' (ㅇ) and 'g' (ㅎ)
146+
// If Old Hangul is enabled, Shift+D and Shift+G should bypass usage of custom phrase
147+
BOOL oldHangul = [[NSUserDefaults standardUserDefaults] boolForKey:@"EnableOldHangul"];
148+
if (oldHangul && (keyCode == 2 || keyCode == 5)) {
149+
lookupKey = nil; // Skip map lookup
150+
}
151+
145152
if (lookupKey) {
146153
NSDictionary *mappings = [defaults dictionaryForKey:@"DKSTCustomShiftMappings"];
147154
NSString *output = [mappings objectForKey:lookupKey];

v2.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@ The Preferences window has been completely redesigned for better usability and c
77

88
- **Reorganized Layout**: Settings are now grouped logically.
99
1. **Caps Lock Switch**: Use Caps Lock to toggle input mode.
10-
2. **Menu Bar Icon**: Select between **Taegeuk** (Default) and **Hangul** icons.
11-
* **Taegeuk**: Traditional Taegeuk shape (`Hangul.pdf` or `Hangul.tiff`).
12-
* **Hangul**: "한" character (`Hangul_2.pdf`).
13-
3. **Moa-chigi**: Enable vowel+consonant combination.
14-
4. **Old Hangul**: Enable archaic script support (e.g., Araea).
15-
5. **Delete by**: Choose between **Jaso** (Unit) and **Gulja** (Syllable) deletion.
16-
6. **Custom Shift Shortcuts**: Enable emoji/text shortcuts.
17-
7. **Mapping Table**: Defines the custom shortcuts.
10+
2. **Moa-chigi**: Enable vowel+consonant combination.
11+
3. **Old Hangul**: Enable archaic script support (e.g., Araea, Old Choseong).
12+
* Supported: `ㅏㅣ`(``), `ㅇㅇ`(``), ``(``) etc.
13+
4. **Delete by**: Choose between **Jaso** (Unit) and **Gulja** (Syllable) deletion.
14+
5. **Custom Shift Shortcuts**: Enable emoji/text shortcuts.
15+
6. **Mapping Table**: Defines the custom shortcuts.
1816
- **Visual Improvements**:
19-
- **Preferences Window**:
20-
- Increased label widths to prevent truncation ("Menu bar icon...").
21-
- Aligned radio buttons for a cleaner layout.
17+
- **UI Cleanup**: Removed unused icon selection options and optimized vertical spacing.
2218
- Added a copyright label "(C) 2025 DINKI'ssTyle".
2319
- Updated default settings:
2420
* **Enable Moa-chigi**: ON
@@ -30,23 +26,27 @@ The Preferences window has been completely redesigned for better usability and c
3026
## 2. Engine Improvements (DKSTHangul)
3127
- **Archaic Syllable Support**:
3228
- Implemented logic to support archaic combinations like "ㅎㆍᆫ".
29+
- **New Combinations**:
30+
- `ㅇㅇ` -> `` (Yesieung)
31+
- `ㅅㅅ` -> `` (Bansiot)
32+
- `ㅎㅎ` -> `` (Yeorinhieuh)
33+
- `ㄱㅅ` -> ``, `ㅂㅅ` -> ``, `ㅂㅈ` -> ``
34+
- `ㅏㅣ` -> `` (Araea-I)
35+
- `Shift+D` -> `` (SsangIeung), `Shift+G` -> `` (KapyeounPhieup)
3336
- Switched to using **Conjoining Jamo (U+11xx)** for archaic syllables instead of Compatibility Jamo, ensuring proper rendering by the OS font engine.
34-
- Fixed a crash issue where invalid combinations were appending null characters.
3537
- **Araea Input**:
3638
- Typing 'ㅏ' (k) + 'ㅏ' (k) now produces Araea ('ᆞ') if "Using old Korean script" is enabled.
37-
- **Moa-chigi**:
38-
- Logic preserved and integrated with new settings.
3939

4040
## 3. System & Build
41+
- **Installation Fix**:
42+
- Updated `install.command` to install the Input Method to the User Library (`~/Library/Input Methods`) instead of the System Library. This resolves permission issues with `Info.plist` modifications and simplifies the install process (no sudo required for install).
4143
- **API Modernization**:
4244
- Replaced the deprecated `launchApplication:` method with `openApplicationAtURL:`.
4345
- Replaced deprecated `absolutePathForAppBundleWithIdentifier:` with `URLForApplicationWithBundleIdentifier:` in Preferences.
4446
- **Icon Support**:
45-
- **Dynamic Icon Switching**: Implemented logic to modify `Info.plist` at runtime to switch between icon files based on user preference.
46-
- **TIFF Conversion**: Converted `Hangul.png` to `Hangul.tiff` to potentially resolve tinting issues (though PDF is primarily used now).
47-
- Added support for PNG/TIFF resource copying in [build.sh](file:///Users/dinki/Documents/GitHub/DINKIssTyle-IME-macOS/build.sh).
47+
- Reverted to static `Hangul.pdf` (Taegeuk) icon as the single standard icon.
4848

4949
## Usage
5050
1. Run [./build.sh](file:///Users/dinki/Documents/GitHub/DINKIssTyle-IME-macOS/build.sh) to compile.
51-
2. Run [./install.command](file:///Users/dinki/Documents/GitHub/DINKIssTyle-IME-macOS/install.command) to install.
52-
3. Logout and login (or restart) to apply icon changes and ensure the input method is fully reloaded.
51+
2. Run [./install.command](file:///Users/dinki/Documents/GitHub/DINKIssTyle-IME-macOS/install.command) to install (Select Option 1).
52+
3. Logout and login (or restart) to ensure the input method is fully reloaded.

0 commit comments

Comments
 (0)