Skip to content

Commit

Permalink
Adds .ttc support (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
talhabalaj authored Jan 28, 2024
1 parent af5c968 commit 79624c3
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
20 changes: 16 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 12 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit 79624c3

Please sign in to comment.