Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.18.3

Feat: Add support to letterSpacing

## 1.18.0

Feat: Languages support (need to be translated)
Expand Down
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": "easy-codesnap",
"displayName": "Easy CodeSnap",
"description": "Take beautiful screenshots of your code 📷",
"version": "1.18.2",
"version": "1.18.3",
"l10n": "./l10n",
"repository": {
"type": "git",
Expand Down
6 changes: 5 additions & 1 deletion src/commands/snap/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { extensionSettingsNames } from "../../constants";
import { getSettings } from "../../util";

export function getConfig() {
const editorSettings = getSettings("editor", ["fontLigatures", "tabSize"]);
const editorSettings = getSettings("editor", [
"fontLigatures",
"tabSize",
"letterSpacing",
]);

const editor = vscode.window.activeTextEditor;
if (editor) {
Expand Down
18 changes: 8 additions & 10 deletions src/reduceSVG.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { type PluginConfig, optimize } from "svgo";
import { type Config, optimize } from "svgo";

const svgoConfig: { plugins: PluginConfig[] } = {
export function reduceSVG(svgContent: string) {
return optimize(svgContent, svgoConfig).data;
}

const svgoConfig: Config = {
floatPrecision: 8,
multipass: true,
plugins: [
{
name: "preset-default",
Expand All @@ -25,11 +31,3 @@ const svgoConfig: { plugins: PluginConfig[] } = {
},
],
};

export function reduceSVG(svgContent: string) {
return optimize(svgContent, {
floatPrecision: 8,
plugins: svgoConfig.plugins,
multipass: true,
}).data;
}
1 change: 1 addition & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface ExtensionConfig {
export interface ConfigSentToWebview extends ExtensionConfig {
startLine: number;
tabSize: number;
letterSpacing: number;
fontLigatures: boolean;
editorID: string;
templates: {
Expand Down
5 changes: 5 additions & 0 deletions src/webview/ui/updaters/VarUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class VarUpdater extends Updater {
"enableResizing",
"roundingLevel",
"showLineNumbers",
"letterSpacing",
]);
}

Expand All @@ -28,13 +29,17 @@ export class VarUpdater extends Updater {
enableResizing,
roundingLevel,
showLineNumbers,
letterSpacing,
} = SessionConfig.get();

setVar("ligatures", fontLigatures ? "normal" : "none");
if (typeof fontLigatures === "string") {
setVar("font-features", fontLigatures);
}

console.log("Letter Spacing", letterSpacing);

setVar("letter-spacing", `${letterSpacing}px`);
setVar("tab-size", tabSize.toString());
setVar("container-background-color", backgroundColor);
setVar("box-shadow", boxShadow);
Expand Down
3 changes: 3 additions & 0 deletions webview/styles/original-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ html {
--container-padding: 3em;
--window-border-radius: 4px;
--enable-resizing: horizontal;
--letter-spacing: 0px;
--zoom: 100%;

box-sizing: border-box;
Expand Down Expand Up @@ -62,6 +63,7 @@ body {
font-family: var(--vscode-editor-font-family);
font-size: calc(var(--vscode-editor-font-size) * 1px);
font-weight: var(--vscode-editor-font-weight);
letter-spacing: var(--letter-spacing);
}

.line {
Expand Down Expand Up @@ -100,6 +102,7 @@ body {
.size-test {
font-family: var(--vscode-editor-font-family) !important;
font-size: calc(var(--vscode-editor-font-size) * 1px) !important;
letter-spacing: var(--letter-spacing) !important;
display: inline-block;
}

Expand Down