From 79624c372b3d80cbb9d00159b3bf3150d5d6451c Mon Sep 17 00:00:00 2001 From: Talha Balaj Date: Sun, 28 Jan 2024 16:35:14 +0500 Subject: [PATCH] Adds `.ttc` support (#5) --- CHANGELOG.md | 20 ++++++++++++++++---- README.md | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- src/extension.ts | 15 ++++++++++++--- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5adad38..436ea2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,21 @@ # Change Log -All notable changes to the "font-changer" extension will be documented in this file. +## 0.0.6 +- `.ttc` font file support -Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. +## 0.0.5 +- Windows fonts support -## [Unreleased] +## 0.0.4 +- Peformance improvement while previewing fonts +- MacOS system and local fonts support + +## 0.0.3 +- Fixed GIF explainer in the README + +## 0.0.2 +- Added support for old versions of VSCode + +## 0.0.1 +- Added `Font Changer: Select Global Font` command -- Initial release \ No newline at end of file diff --git a/README.md b/README.md index f2e27c2..75915b9 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ The Font Changer Extension for Visual Studio Code is a handy tool that allows yo ## Release Notes + +### 0.0.6 +- `.ttc` font file support + ### 0.0.5 - Windows fonts support diff --git a/package-lock.json b/package-lock.json index 280a208..79dada4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "actual-font-changer", - "version": "0.0.4", + "version": "0.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "actual-font-changer", - "version": "0.0.4", + "version": "0.0.5", "dependencies": { "@total-typescript/ts-reset": "^0.5.1", "fontkit": "^2.0.2" diff --git a/package.json b/package.json index 78ab894..467732d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "actual-font-changer", "displayName": "Font Changer", "description": "Quickly changes fonts by selecting from a installed fonts", - "version": "0.0.5", + "version": "0.0.6", "publisher": "talhabalaj", "repository": { "url": "https://github.com/talhabalaj/vscode-font-changer" diff --git a/src/extension.ts b/src/extension.ts index 2ad2b2b..d63d0be 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -28,7 +28,11 @@ async function findFonts(paths: vscode.Uri[]) { const fonts = await findFonts(uris); return fonts.flat(); } else if (isFileOrLink(fileStat)) { - if (uri.path.endsWith(".otf") || uri.path.endsWith(".ttf")) { + if ( + uri.path.endsWith(".otf") || + uri.path.endsWith(".ttf") || + uri.path.endsWith(".ttc") + ) { try { const font = await openFont(uri.fsPath); @@ -81,14 +85,19 @@ export function activate(context: vscode.ExtensionContext) { let disposable = vscode.commands.registerCommand( "font-changer.selectFont", async () => { - const userDir = vscode.Uri.file(process.env.HOME || process.env.USERPROFILE || "/root"); + const userDir = vscode.Uri.file( + process.env.HOME || process.env.USERPROFILE || "/root" + ); const os = process.platform; const uris: vscode.Uri[] = []; if (os === "win32") { const windowsUris = [ vscode.Uri.file("c:\\Windows\\Fonts"), - vscode.Uri.joinPath(userDir, `AppData\\Local\\Microsoft\\Windows\\Fonts`), + vscode.Uri.joinPath( + userDir, + `AppData\\Local\\Microsoft\\Windows\\Fonts` + ), ]; uris.push(...windowsUris); } else if (os === "linux") {