sieukrem / jn-npp-plugin

Plugin for Notepad++ allowing you to automate some tasks using JavaScript
https://github.com/sieukrem/jn-npp-plugin/wiki
110 stars 24 forks source link

Some enums and a script to be added #58

Closed KOLANICH closed 6 years ago

KOLANICH commented 6 years ago

Here is the script enabling better font rendering (needed to make ligatures and kerning work)

require("lib/Scintilla.js")
Scintilla.prototype.Const.SCI_SETTECHNOLOGY=2630;
Scintilla.prototype.Const.SCI_GETTECHNOLOGY=2631;
Scintilla.prototype.Const.SC_TECHNOLOGY_DEFAULT=0;
Scintilla.prototype.Const.SC_TECHNOLOGY_DIRECTWRITE=1;
Scintilla.prototype.Const.SC_TECHNOLOGY_DIRECTWRITERETAIN=2;
Scintilla.prototype.Const.SC_TECHNOLOGY_DIRECTWRITEDC=3;
var sci = new Scintilla(currentView.handle);
sci.Call("SCI_SETTECHNOLOGY", Scintilla.prototype.Const.SC_TECHNOLOGY_DIRECTWRITE, 0);

1 I guess the enums from it should be added into Scintilla.js 2 I guess the script should be added into the repo

BTW: require causes error.

sieukrem commented 6 years ago

I have integrated the new constants and added a snippet showing how to use them on wiki

KOLANICH commented 6 years ago

I can recognize the difference between them and I like the default one :).

In fact the default one has drawback - ligatures, such as in Fira Code, don't work. Maybe so does kerning, so there should be differences. It's a shame that NPP doesn't have the switch in the settings built-in. That snippet is just a port of the lua one.

KOLANICH commented 6 years ago

Also the script throws an exception. require doesn't work correctly. At least on my system. To test it I had to open all the dependencies in editor, select everything but require and run the selection.

sieukrem commented 6 years ago

What error do you get? Did you compare the implementation of require in start.js

KOLANICH commented 6 years ago

What error do you get?

I'll test tommorow.

Did you compare the implementation of require in start.js

In fact I don't remember. I did some tests (if I remember right, I have even temporarely replaced my forked version with the version from this repo), but I don't remember well.

KOLANICH commented 6 years ago

I have checked. That was my fault. I have screwed up some things. Now they are fixed.