khmer-telegram 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.4
2
+ Name: khmer-telegram
3
+ Version: 1.0.0
4
+ Summary: Fix Khmer font text rendering issues in Telegram Desktop on Windows
5
+ Author:
6
+ License: MIT
7
+ Classifier: Operating System :: Microsoft :: Windows
8
+ Classifier: Programming Language :: Python :: 3
9
+ Dynamic: classifier
10
+ Dynamic: license
11
+ Dynamic: summary
@@ -0,0 +1,54 @@
1
+ # Khmer Telegram Text Fix
2
+
3
+ Automatic tool to fix Khmer text rendering issues on Telegram Desktop for Windows.
4
+
5
+ ## Quick Usage for End Users
6
+
7
+ ### Via npm / npx (Node.js)
8
+ Anyone with Node.js installed can simply open Terminal / Command Prompt and run:
9
+ ```bash
10
+ npx khmer-telegram
11
+ ```
12
+
13
+ ### Via pip (Python)
14
+ Anyone with Python installed can run:
15
+ ```bash
16
+ pip install khmer-telegram
17
+ khmer-telegram
18
+ ```
19
+
20
+ ---
21
+
22
+ ## How to Publish to Cloud (npm & PyPI)
23
+
24
+ ### 1. Publishing to npm (for `npx khmer-telegram`)
25
+
26
+ 1. Open your terminal in this folder (`D:\fixkhmertelegram`).
27
+ 2. Log in to your npm account (create one at [npmjs.com](https://www.npmjs.com) if you haven't):
28
+ ```bash
29
+ npm login
30
+ ```
31
+ 3. Publish your package:
32
+ ```bash
33
+ npm publish --access public --otp=YOUR_6_DIGIT_CODE
34
+ ```
35
+ *Once published, anyone in the world can run `npx khmer-telegram`!*
36
+
37
+ ---
38
+
39
+ ### 2. Publishing to PyPI (for `pip install khmer-telegram`)
40
+
41
+ 1. Open terminal in this folder (`D:\fixkhmertelegram`).
42
+ 2. Install build and twine tools:
43
+ ```bash
44
+ pip install build twine
45
+ ```
46
+ 3. Build the package distribution:
47
+ ```bash
48
+ python -m build
49
+ ```
50
+ 4. Upload to PyPI (create account at [pypi.org](https://pypi.org)):
51
+ ```bash
52
+ python -m twine upload dist/*
53
+ ```
54
+ *Once published, anyone can install via `pip install khmer-telegram`!*
@@ -0,0 +1,51 @@
1
+ import os
2
+ import sys
3
+ import subprocess
4
+ import base64
5
+
6
+ def run():
7
+ if sys.platform != "win32":
8
+ print("[ERROR] This package is designed for Windows OS only.")
9
+ sys.exit(1)
10
+
11
+ base_dir = os.path.dirname(os.path.abspath(__file__))
12
+ # When installed as package, resources are in package directory or parent
13
+ font_path = os.path.join(base_dir, "..", "Khmer OS Content Regular.ttf")
14
+ reg_path = os.path.join(base_dir, "..", "KhmerOSContent.reg")
15
+
16
+ if not os.path.exists(font_path):
17
+ font_path = os.path.join(base_dir, "Khmer OS Content Regular.ttf")
18
+ if not os.path.exists(reg_path):
19
+ reg_path = os.path.join(base_dir, "KhmerOSContent.reg")
20
+
21
+ print("===================================================")
22
+ print(" Fixing Khmer Text Rendering in Telegram Desktop")
23
+ print("===================================================")
24
+ print("Requesting Administrator permissions...\n")
25
+
26
+ ps_script = f"""
27
+ $fontSrc = '{font_path}';
28
+ $regSrc = '{reg_path}';
29
+
30
+ Copy-Item -Path $fontSrc -Destination "$env:windir\\Fonts\\" -Force;
31
+ New-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts' -Name 'Khmer OS Content (TrueType)' -Value 'Khmer OS Content Regular.ttf' -PropertyType String -Force | Out-Null;
32
+ reg import $regSrc;
33
+
34
+ Write-Host '===================================================' -ForegroundColor Green;
35
+ Write-Host '[SUCCESS] Khmer Font installed & Telegram Registry fix applied!' -ForegroundColor Green;
36
+ Write-Host 'Please restart Telegram Desktop (or restart your PC).' -ForegroundColor Yellow;
37
+ Write-Host '===================================================' -ForegroundColor Green;
38
+ Start-Sleep -Seconds 5;
39
+ """
40
+
41
+ encoded_cmd = base64.b64encode(ps_script.encode('utf-16le')).decode('utf-8')
42
+ cmd = f"powershell -NoProfile -Command \"Start-Process powershell -Verb RunAs -ArgumentList '-NoProfile -EncodedCommand {encoded_cmd}'\""
43
+
44
+ try:
45
+ subprocess.run(cmd, shell=True, check=True)
46
+ print("Installer triggered successfully. Please approve the Windows UAC Administrator prompt.")
47
+ except Exception as e:
48
+ print(f"[ERROR] Failed to run command: {e}")
49
+
50
+ if __name__ == "__main__":
51
+ run()
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.4
2
+ Name: khmer-telegram
3
+ Version: 1.0.0
4
+ Summary: Fix Khmer font text rendering issues in Telegram Desktop on Windows
5
+ Author:
6
+ License: MIT
7
+ Classifier: Operating System :: Microsoft :: Windows
8
+ Classifier: Programming Language :: Python :: 3
9
+ Dynamic: classifier
10
+ Dynamic: license
11
+ Dynamic: summary
@@ -0,0 +1,8 @@
1
+ README.md
2
+ setup.py
3
+ fix_khmer_telegram/__init__.py
4
+ khmer_telegram.egg-info/PKG-INFO
5
+ khmer_telegram.egg-info/SOURCES.txt
6
+ khmer_telegram.egg-info/dependency_links.txt
7
+ khmer_telegram.egg-info/entry_points.txt
8
+ khmer_telegram.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ khmer-telegram = fix_khmer_telegram:run
@@ -0,0 +1 @@
1
+ fix_khmer_telegram
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,30 @@
1
+ import os
2
+ import sys
3
+ import subprocess
4
+ from setuptools import setup, find_packages
5
+
6
+ def main():
7
+ setup(
8
+ name="khmer-telegram",
9
+ version="1.0.0",
10
+ description="Fix Khmer font text rendering issues in Telegram Desktop on Windows",
11
+ author="",
12
+ license="MIT",
13
+ packages=find_packages(),
14
+ package_data={
15
+ "": ["Khmer OS Content Regular.ttf", "KhmerOSContent.reg"]
16
+ },
17
+ include_package_data=True,
18
+ entry_points={
19
+ "console_scripts": [
20
+ "khmer-telegram=fix_khmer_telegram:run",
21
+ ],
22
+ },
23
+ classifiers=[
24
+ "Operating System :: Microsoft :: Windows",
25
+ "Programming Language :: Python :: 3",
26
+ ],
27
+ )
28
+
29
+ if __name__ == "__main__":
30
+ main()