From 37c1b5d8e2b4e6ce7f66c483663356cd279999ec Mon Sep 17 00:00:00 2001 From: Antibioticss Date: Sun, 3 Nov 2024 12:27:54 +0800 Subject: [PATCH] Add support for text size Fix text size error --- README.md | 4 ++++ index.js | 6 +++++- lib/entry.js | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 08e76d5..0e7b119 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ Set the background image to file specified by `path`. Set the background color to the color specified by three floats between 0 and 1. +### file.setTextSize(size) + +Set the size of all texts below all icons to `size`. + ### file.setIconSize(size) Set the size of all icons in the folder to `size`. diff --git a/index.js b/index.js index 2c6d3fb..c4ad320 100644 --- a/index.js +++ b/index.js @@ -20,6 +20,10 @@ Helper.prototype.setBackgroundColor = function (red, green, blue) { this.opts.backgroundColor = [red, green, blue] } +Helper.prototype.setTextSize = function (size) { + this.opts.textSize = size +} + Helper.prototype.setIconSize = function (size) { this.opts.iconSize = size } @@ -55,7 +59,7 @@ Helper.prototype.write = function (path, cb) { } this.file.push(Entry.construct('.', 'bwsp', this.opts.window)) - this.file.push(Entry.construct('.', 'icvp', { iconSize: this.opts.iconSize, rawAlias: rawAlias, colorComponents: colorComponents })) + this.file.push(Entry.construct('.', 'icvp', { textSize: this.opts.textSize, iconSize: this.opts.iconSize, rawAlias: rawAlias, colorComponents: colorComponents })) this.file.write(path, cb) } diff --git a/lib/entry.js b/lib/entry.js index 482025f..6058b71 100644 --- a/lib/entry.js +++ b/lib/entry.js @@ -133,7 +133,7 @@ Entry.construct = function (filename, structureId, opts) { backgroundColorBlue: new bplist.Real(1), showIconPreview: true, showItemInfo: false, - textSize: new bplist.Real(12), + textSize: new bplist.Real(opt('textSize')), iconSize: new bplist.Real(opt('iconSize')), viewOptionsVersion: 1, gridSpacing: new bplist.Real(100),