Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38511 > unrolled thread
| Started by | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| First post | 2020-07-16 05:22 -0700 |
| Last post | 2020-07-19 14:17 -0700 |
| Articles | 20 on this page of 31 — 5 participants |
Back to article view | Back to comp.lang.javascript
Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-16 05:22 -0700
Re: Canvas Unicode sign lister Julio Di Egidio <julio@diegidio.name> - 2020-07-16 05:57 -0700
Re: Canvas Unicode sign lister JJ <jj4public@vfemail.net> - 2020-07-16 23:40 +0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-16 10:18 -0700
Re: Canvas Unicode sign lister luserdroog <luser.droog@gmail.com> - 2020-07-16 15:46 -0700
Re: Canvas Unicode sign lister Julio Di Egidio <julio@diegidio.name> - 2020-07-17 01:33 -0700
Re: Canvas Unicode sign lister Julio Di Egidio <julio@diegidio.name> - 2020-07-17 01:45 -0700
Re: Canvas Unicode sign lister luserdroog <luser.droog@gmail.com> - 2020-07-18 11:45 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-18 06:09 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-18 08:22 -0700
Re: Canvas Unicode sign lister luserdroog <luser.droog@gmail.com> - 2020-07-18 11:53 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-18 12:32 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-18 12:52 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-18 13:14 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-18 16:07 -0700
Re: Canvas Unicode sign lister Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-07-19 14:25 +0100
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-19 07:30 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-19 08:05 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-18 13:29 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-18 08:32 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-18 08:45 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-18 09:01 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-18 09:44 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-18 10:03 -0700
Re: Canvas Unicode sign lister JJ <jj4public@vfemail.net> - 2020-07-19 20:47 +0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-19 07:41 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-19 09:41 -0700
Re: Canvas Unicode sign lister luserdroog <luser.droog@gmail.com> - 2020-07-19 11:53 -0700
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-19 12:00 -0700
Re: Canvas Unicode sign lister Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-07-19 20:58 +0100
Re: Canvas Unicode sign lister Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-07-19 14:17 -0700
Page 1 of 2 [1] 2 Next page →
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-16 05:22 -0700 |
| Subject | Canvas Unicode sign lister |
| Message-ID | <b7fe653a-0627-4fc5-89e2-793f4e3a5114o@googlegroups.com> |
Do anyone have a script to list unicode signs in an interval? JT
[toc] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2020-07-16 05:57 -0700 |
| Message-ID | <4807bf10-9525-4b13-826f-0f423d284beco@googlegroups.com> |
| In reply to | #38511 |
On Thursday, 16 July 2020 14:22:22 UTC+2, Jonas Thörnvall wrote:
> Do anyone have a script to list unicode signs in an interval?
Here is a basic example:
--------------
function logCodes(minCode, maxCode) {
for (var c = minCode; c <= maxCode; ++c) {
console.log(String.fromCharCode(c));
}
}
logCodes(4096, 5072);
--------------
But look up the docs, depending on what you need you may want
String.fromCodePoint instead, just beware that's ECMAScript 2015.
HTH,
Julio
[toc] | [prev] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2020-07-16 23:40 +0700 |
| Message-ID | <1rn5i2rstz0fb.1qjksyko9cd23.dlg@40tude.net> |
| In reply to | #38511 |
On Thu, 16 Jul 2020 05:22:13 -0700 (PDT), Jonas Thörnvall wrote: > Do anyone have a script to list unicode signs in an interval? > > JT Signs? If you meant symbol/graphical characters, see: https://en.wikipedia.org/wiki/Unicode_symbols
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-16 10:18 -0700 |
| Message-ID | <8c2432e2-05fa-4893-a19c-55b1b3b85f90o@googlegroups.com> |
| In reply to | #38513 |
Den torsdag 16 juli 2020 kl. 18:40:55 UTC+2 skrev JJ:
> On Thu, 16 Jul 2020 05:22:13 -0700 (PDT), Jonas Thörnvall wrote:
> > Do anyone have a script to list unicode signs in an interval?
> >
> > JT
>
> Signs? If you meant symbol/graphical characters, see:
>
> https://en.wikipedia.org/wiki/Unicode_symbols
Well i found howto do it i just did wonder if anyone have something to readily do it in table form with a range.
ctm.fillText("\u{1D122}", 100, 250);
[toc] | [prev] | [next] | [standalone]
| From | luserdroog <luser.droog@gmail.com> |
|---|---|
| Date | 2020-07-16 15:46 -0700 |
| Message-ID | <9e41a176-1061-43c5-b558-9dc801a77349o@googlegroups.com> |
| In reply to | #38514 |
On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
> Den torsdag 16 juli 2020 kl. 18:40:55 UTC+2 skrev JJ:
> > On Thu, 16 Jul 2020 05:22:13 -0700 (PDT), Jonas Thörnvall wrote:
> > > Do anyone have a script to list unicode signs in an interval?
> > >
> > > JT
> >
> > Signs? If you meant symbol/graphical characters, see:
> >
> > https://en.wikipedia.org/wiki/Unicode_symbols
>
> Well i found howto do it i just did wonder if anyone have something to readily do it in table form with a range.
>
> ctm.fillText("\u{1D122}", 100, 250);
function codes(minCode, maxCode) {
let a = [];
for (var c = minCode; c <= maxCode; ++c) {
a.push(String.fromCharCode(c));
}
return a;
}
codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
?
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2020-07-17 01:33 -0700 |
| Message-ID | <2ad91df6-3995-4451-93e8-e23f0d6e75c5o@googlegroups.com> |
| In reply to | #38515 |
On Friday, 17 July 2020 00:46:22 UTC+2, luserdroog wrote:
> On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
> > Well i found howto do it i just did wonder if anyone have something to
> > readily do it in table form with a range.
> >
> > ctm.fillText("\u{1D122}", 100, 250);
>
> function codes(minCode, maxCode) {
> let a = [];
> for (var c = minCode; c <= maxCode; ++c) {
> a.push(String.fromCharCode(c));
> }
> return a;
> }
>
> codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
>
> ?
OK, but now notice that you are running the loop twice plus creating an
array in the process, so let's get it to the next level. Unless you do
need to create and keep an array for some other reason, you generally
rather want something like this:
----------------
// an "iterator":
function forCharCodes(min, max, cb) {
for (var c = min, i = 0; c <= max; ++c, ++i) {
cb(c, i);
}
}
// example usage:
forCharCodes(4096, 4224, function (c, i) {
console.log("[" + i + "] (" + c + ") " + String.fromCharCode(c));
});
----------------
Julio
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2020-07-17 01:45 -0700 |
| Message-ID | <ee9c335f-b316-4309-89c9-02d710b3cea2o@googlegroups.com> |
| In reply to | #38516 |
On Friday, 17 July 2020 10:33:56 UTC+2, Julio Di Egidio wrote:
> On Friday, 17 July 2020 00:46:22 UTC+2, luserdroog wrote:
> > On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
>
> > > Well i found howto do it i just did wonder if anyone have something to
> > > readily do it in table form with a range.
> > >
> > > ctm.fillText("\u{1D122}", 100, 250);
> >
> > function codes(minCode, maxCode) {
> > let a = [];
> > for (var c = minCode; c <= maxCode; ++c) {
> > a.push(String.fromCharCode(c));
> > }
> > return a;
> > }
> >
> > codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
> >
> > ?
>
> OK, but now notice that you are running the loop twice plus creating an
> array in the process, so let's get it to the next level. Unless you do
> need to create and keep an array for some other reason, you generally
> rather want something like this:
>
> ----------------
> // an "iterator":
> function forCharCodes(min, max, cb) {
> for (var c = min, i = 0; c <= max; ++c, ++i) {
> cb(c, i);
> }
> }
>
> // example usage:
> forCharCodes(4096, 4224, function (c, i) {
> console.log("[" + i + "] (" + c + ") " + String.fromCharCode(c));
> });
> ----------------
In fact, now that the iteration logic is abstracted away, you can even do
this if you do need an array:
----------------
var myCodes = [];
forCharCodes(4096, 4224, function (c) {
myCodes.push(c);
});
----------------
Julio
[toc] | [prev] | [next] | [standalone]
| From | luserdroog <luser.droog@gmail.com> |
|---|---|
| Date | 2020-07-18 11:45 -0700 |
| Message-ID | <e814162f-9191-4daf-adb6-4cdb708ef54do@googlegroups.com> |
| In reply to | #38517 |
On Friday, July 17, 2020 at 3:45:08 AM UTC-5, Julio Di Egidio wrote:
> On Friday, 17 July 2020 10:33:56 UTC+2, Julio Di Egidio wrote:
> > On Friday, 17 July 2020 00:46:22 UTC+2, luserdroog wrote:
> > > On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
> >
> > > > Well i found howto do it i just did wonder if anyone have something to
> > > > readily do it in table form with a range.
> > > >
> > > > ctm.fillText("\u{1D122}", 100, 250);
> > >
> > > function codes(minCode, maxCode) {
> > > let a = [];
> > > for (var c = minCode; c <= maxCode; ++c) {
> > > a.push(String.fromCharCode(c));
> > > }
> > > return a;
> > > }
> > >
> > > codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
> > >
> > > ?
> >
> > OK, but now notice that you are running the loop twice plus creating an
> > array in the process, so let's get it to the next level. Unless you do
> > need to create and keep an array for some other reason, you generally
> > rather want something like this:
> >
> > ----------------
> > // an "iterator":
> > function forCharCodes(min, max, cb) {
> > for (var c = min, i = 0; c <= max; ++c, ++i) {
> > cb(c, i);
> > }
> > }
> >
> > // example usage:
> > forCharCodes(4096, 4224, function (c, i) {
> > console.log("[" + i + "] (" + c + ") " + String.fromCharCode(c));
> > });
> > ----------------
>
> In fact, now that the iteration logic is abstracted away, you can even do
> this if you do need an array:
>
> ----------------
> var myCodes = [];
> forCharCodes(4096, 4224, function (c) {
> myCodes.push(c);
> });
> ----------------
>
Thanks. That's much better.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-18 06:09 -0700 |
| Message-ID | <348a3a36-82a9-4e81-9448-261c424f6be5o@googlegroups.com> |
| In reply to | #38515 |
Den fredag 17 juli 2020 kl. 00:46:22 UTC+2 skrev luserdroog:
> On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
> > Den torsdag 16 juli 2020 kl. 18:40:55 UTC+2 skrev JJ:
> > > On Thu, 16 Jul 2020 05:22:13 -0700 (PDT), Jonas Thörnvall wrote:
> > > > Do anyone have a script to list unicode signs in an interval?
> > > >
> > > > JT
> > >
> > > Signs? If you meant symbol/graphical characters, see:
> > >
> > > https://en.wikipedia.org/wiki/Unicode_symbols
> >
> > Well i found howto do it i just did wonder if anyone have something to readily do it in table form with a range.
> >
> > ctm.fillText("\u{1D122}", 100, 250);
>
> function codes(minCode, maxCode) {
> let a = [];
> for (var c = minCode; c <= maxCode; ++c) {
> a.push(String.fromCharCode(c));
> }
> return a;
> }
>
> codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
>
> ?
Very nice i just have to relist them into some square shape with respective numbers, will be useful.
Now i have to search internet pages...
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-18 08:22 -0700 |
| Message-ID | <70df40b6-f69c-45ad-adc5-d813c6edf542o@googlegroups.com> |
| In reply to | #38515 |
Den fredag 17 juli 2020 kl. 00:46:22 UTC+2 skrev luserdroog:
> On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
> > Den torsdag 16 juli 2020 kl. 18:40:55 UTC+2 skrev JJ:
> > > On Thu, 16 Jul 2020 05:22:13 -0700 (PDT), Jonas Thörnvall wrote:
> > > > Do anyone have a script to list unicode signs in an interval?
> > > >
> > > > JT
> > >
> > > Signs? If you meant symbol/graphical characters, see:
> > >
> > > https://en.wikipedia.org/wiki/Unicode_symbols
> >
> > Well i found howto do it i just did wonder if anyone have something to readily do it in table form with a range.
> >
> > ctm.fillText("\u{1D122}", 100, 250);
>
> function codes(minCode, maxCode) {
> let a = [];
> for (var c = minCode; c <= maxCode; ++c) {
> a.push(String.fromCharCode(c));
> }
> return a;
> }
>
> codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
>
> ?
Hello luserdroog could you help me out build an allowed string from
ustring='"\u'+hexString+'}"';
I thought the above was ok, but it is not.
[toc] | [prev] | [next] | [standalone]
| From | luserdroog <luser.droog@gmail.com> |
|---|---|
| Date | 2020-07-18 11:53 -0700 |
| Message-ID | <47fc2b06-23f3-42fe-a124-839892397109o@googlegroups.com> |
| In reply to | #38523 |
On Saturday, July 18, 2020 at 10:22:54 AM UTC-5, Jonas Thörnvall wrote:
> Den fredag 17 juli 2020 kl. 00:46:22 UTC+2 skrev luserdroog:
> > On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
> > > Den torsdag 16 juli 2020 kl. 18:40:55 UTC+2 skrev JJ:
> > > > On Thu, 16 Jul 2020 05:22:13 -0700 (PDT), Jonas Thörnvall wrote:
> > > > > Do anyone have a script to list unicode signs in an interval?
> > > > >
> > > > > JT
> > > >
> > > > Signs? If you meant symbol/graphical characters, see:
> > > >
> > > > https://en.wikipedia.org/wiki/Unicode_symbols
> > >
> > > Well i found howto do it i just did wonder if anyone have something to readily do it in table form with a range.
> > >
> > > ctm.fillText("\u{1D122}", 100, 250);
> >
> > function codes(minCode, maxCode) {
> > let a = [];
> > for (var c = minCode; c <= maxCode; ++c) {
> > a.push(String.fromCharCode(c));
> > }
> > return a;
> > }
> >
> > codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
> >
> > ?
>
> Hello luserdroog could you help me out build an allowed string from
> ustring='"\u'+hexString+'}"';
>
> I thought the above was ok, but it is not.
What's the curly brace for? That doesn't look right. And having the
double quotes in there also looks clumsy. If I needed that I'd make
a function wrapQuotes() to just do that part.
But, just use String.fromCharCode(). I have sometimes built unicode
glyphs by using an html entity.
s = '&#x' + '1D122' + ';';
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-18 12:32 -0700 |
| Message-ID | <0634a62a-a1ba-47b1-b281-d99a6c82ea02o@googlegroups.com> |
| In reply to | #38531 |
Den lördag 18 juli 2020 kl. 20:53:15 UTC+2 skrev luserdroog:
> On Saturday, July 18, 2020 at 10:22:54 AM UTC-5, Jonas Thörnvall wrote:
> > Den fredag 17 juli 2020 kl. 00:46:22 UTC+2 skrev luserdroog:
> > > On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
> > > > Den torsdag 16 juli 2020 kl. 18:40:55 UTC+2 skrev JJ:
> > > > > On Thu, 16 Jul 2020 05:22:13 -0700 (PDT), Jonas Thörnvall wrote:
> > > > > > Do anyone have a script to list unicode signs in an interval?
> > > > > >
> > > > > > JT
> > > > >
> > > > > Signs? If you meant symbol/graphical characters, see:
> > > > >
> > > > > https://en.wikipedia.org/wiki/Unicode_symbols
> > > >
> > > > Well i found howto do it i just did wonder if anyone have something to readily do it in table form with a range.
> > > >
> > > > ctm.fillText("\u{1D122}", 100, 250);
> > >
> > > function codes(minCode, maxCode) {
> > > let a = [];
> > > for (var c = minCode; c <= maxCode; ++c) {
> > > a.push(String.fromCharCode(c));
> > > }
> > > return a;
> > > }
> > >
> > > codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
> > >
> > > ?
> >
> > Hello luserdroog could you help me out build an allowed string from
> > ustring='"\u'+hexString+'}"';
> >
> > I thought the above was ok, but it is not.
>
> What's the curly brace for? That doesn't look right. And having the
> double quotes in there also looks clumsy. If I needed that I'd make
> a function wrapQuotes() to just do that part.
>
> But, just use String.fromCharCode(). I have sometimes built unicode
> glyphs by using an html entity.
>
> s = '&#x' + '1D122' + ';';
Well this is the strig i try to build, your did not write out the full unicode charset.
This way of writing do
ctm.fillText("\u{1D122}", 100, 250);
But i must construct "\u{1D122}" from "\{+hexstring+}"
My qqeustion is howto do that.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-18 12:52 -0700 |
| Message-ID | <b6332ca6-894b-4e92-9355-74e1ffeb6398o@googlegroups.com> |
| In reply to | #38531 |
Den lördag 18 juli 2020 kl. 20:53:15 UTC+2 skrev luserdroog:
> On Saturday, July 18, 2020 at 10:22:54 AM UTC-5, Jonas Thörnvall wrote:
> > Den fredag 17 juli 2020 kl. 00:46:22 UTC+2 skrev luserdroog:
> > > On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
> > > > Den torsdag 16 juli 2020 kl. 18:40:55 UTC+2 skrev JJ:
> > > > > On Thu, 16 Jul 2020 05:22:13 -0700 (PDT), Jonas Thörnvall wrote:
> > > > > > Do anyone have a script to list unicode signs in an interval?
> > > > > >
> > > > > > JT
> > > > >
> > > > > Signs? If you meant symbol/graphical characters, see:
> > > > >
> > > > > https://en.wikipedia.org/wiki/Unicode_symbols
> > > >
> > > > Well i found howto do it i just did wonder if anyone have something to readily do it in table form with a range.
> > > >
> > > > ctm.fillText("\u{1D122}", 100, 250);
> > >
> > > function codes(minCode, maxCode) {
> > > let a = [];
> > > for (var c = minCode; c <= maxCode; ++c) {
> > > a.push(String.fromCharCode(c));
> > > }
> > > return a;
> > > }
> > >
> > > codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
> > >
> > > ?
> >
> > Hello luserdroog could you help me out build an allowed string from
> > ustring='"\u'+hexString+'}"';
> >
> > I thought the above was ok, but it is not.
>
> What's the curly brace for? That doesn't look right. And having the
> double quotes in there also looks clumsy. If I needed that I'd make
> a function wrapQuotes() to just do that part.
>
> But, just use String.fromCharCode(). I have sometimes built unicode
> glyphs by using an html entity.
>
> s = '&#x' + '1D122' + ';';
Ok got it to work with charCode was something wrong before i got undefined after listing the first ones.
Thanks again luserdroog, should i add some more info?
<HTML>
<BODY BGCOLOR=YELLOW>
<B><font size=5>UNICODE SYMBOLS</font>
MIN - <input type="number" id="xmin" name="xmin" value=0 size="10">
MAX<input type="number" id="xmax" name="xmax" value=720 size="10"></B>
<input type="submit" value="Page+" onclick="plus()"> |
<input type="submit" value="Page-" onclick="minus()">
<br>
</BODY>
</HTML>
<canvas id="myCanvas" width="1900" height="890"></canvas>
<script>
var c = document.getElementById("myCanvas");
var ctm = c.getContext("2d");
function plus(){
document.getElementById('xmin').value=min+720;
document.getElementById('xmax').value=max+720;
unicode();
}
function minus(){
if(min>0){
document.getElementById('xmin').value=min-720;
document.getElementById('xmax').value=max-720;
unicode();
}
}
let uniarr = [];
function unicode(){
ctm.fillStyle = "#000000";
ctm.fillRect(0, 0, 1900, 880);
var k=20;
var l=30;
min=document.getElementById('xmin').value;
max=document.getElementById('xmax').value;
min=parseInt(min);
max=parseInt(max);
for(var i=min;i<max; i++){
//hexString = i.toString(16);
//ustring='"\\'+'u{'+hexString+'}"';
//uniarr.push(ustring);
uniarr.push(String.fromCharCode(i));
}
var j=min;
while (j<max){
ctm.font = "32px courier bold";
ctm.fillStyle = 'white';
ctm.fillText(uniarr[j],k, l );
ctm.font = "12px courier bold";
ctm.fillStyle = 'white';
ctm.fillText(j,k, l+20 );
k=k+40;
j++;
if(k>1800){k=20;l=l+54;};
}
}
unicode();
</script>
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-18 13:14 -0700 |
| Message-ID | <de586e84-97d4-4460-a474-cc3b11cd2655o@googlegroups.com> |
| In reply to | #38531 |
Den lördag 18 juli 2020 kl. 20:53:15 UTC+2 skrev luserdroog:
> On Saturday, July 18, 2020 at 10:22:54 AM UTC-5, Jonas Thörnvall wrote:
> > Den fredag 17 juli 2020 kl. 00:46:22 UTC+2 skrev luserdroog:
> > > On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
> > > > Den torsdag 16 juli 2020 kl. 18:40:55 UTC+2 skrev JJ:
> > > > > On Thu, 16 Jul 2020 05:22:13 -0700 (PDT), Jonas Thörnvall wrote:
> > > > > > Do anyone have a script to list unicode signs in an interval?
> > > > > >
> > > > > > JT
> > > > >
> > > > > Signs? If you meant symbol/graphical characters, see:
> > > > >
> > > > > https://en.wikipedia.org/wiki/Unicode_symbols
> > > >
> > > > Well i found howto do it i just did wonder if anyone have something to readily do it in table form with a range.
> > > >
> > > > ctm.fillText("\u{1D122}", 100, 250);
> > >
> > > function codes(minCode, maxCode) {
> > > let a = [];
> > > for (var c = minCode; c <= maxCode; ++c) {
> > > a.push(String.fromCharCode(c));
> > > }
> > > return a;
> > > }
> > >
> > > codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
> > >
> > > ?
> >
> > Hello luserdroog could you help me out build an allowed string from
> > ustring='"\u'+hexString+'}"';
> >
> > I thought the above was ok, but it is not.
>
> What's the curly brace for? That doesn't look right. And having the
> double quotes in there also looks clumsy. If I needed that I'd make
> a function wrapQuotes() to just do that part.
>
> But, just use String.fromCharCode(). I have sometimes built unicode
> glyphs by using an html entity.
>
> s = '&#x' + '1D122' + ';';
Something is wrong/strange????
fromCharCode(119074) is not same as "\u{1D122}"
Why is it not same UTF format?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-18 16:07 -0700 |
| Message-ID | <5679eb74-14a7-45bb-b4e0-63a170db93a0o@googlegroups.com> |
| In reply to | #38534 |
Den lördag 18 juli 2020 kl. 22:14:13 UTC+2 skrev Jonas Thörnvall:
> Den lördag 18 juli 2020 kl. 20:53:15 UTC+2 skrev luserdroog:
> > On Saturday, July 18, 2020 at 10:22:54 AM UTC-5, Jonas Thörnvall wrote:
> > > Den fredag 17 juli 2020 kl. 00:46:22 UTC+2 skrev luserdroog:
> > > > On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
> > > > > Den torsdag 16 juli 2020 kl. 18:40:55 UTC+2 skrev JJ:
> > > > > > On Thu, 16 Jul 2020 05:22:13 -0700 (PDT), Jonas Thörnvall wrote:
> > > > > > > Do anyone have a script to list unicode signs in an interval?
> > > > > > >
> > > > > > > JT
> > > > > >
> > > > > > Signs? If you meant symbol/graphical characters, see:
> > > > > >
> > > > > > https://en.wikipedia.org/wiki/Unicode_symbols
> > > > >
> > > > > Well i found howto do it i just did wonder if anyone have something to readily do it in table form with a range.
> > > > >
> > > > > ctm.fillText("\u{1D122}", 100, 250);
> > > >
> > > > function codes(minCode, maxCode) {
> > > > let a = [];
> > > > for (var c = minCode; c <= maxCode; ++c) {
> > > > a.push(String.fromCharCode(c));
> > > > }
> > > > return a;
> > > > }
> > > >
> > > > codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
> > > >
> > > > ?
> > >
> > > Hello luserdroog could you help me out build an allowed string from
> > > ustring='"\u'+hexString+'}"';
> > >
> > > I thought the above was ok, but it is not.
> >
> > What's the curly brace for? That doesn't look right. And having the
> > double quotes in there also looks clumsy. If I needed that I'd make
> > a function wrapQuotes() to just do that part.
> >
> > But, just use String.fromCharCode(). I have sometimes built unicode
> > glyphs by using an html entity.
> >
> > s = '&#x' + '1D122' + ';';
>
> Something is wrong/strange????
> https://midisequenser.000webhostapp.com/unicode.html
>
> Why is it not same UTF format?
https://midisequenser.000webhostapp.com/unicode.html
Why it bangs out as undefined if you chose to write in a high number instead of using page is beyond my understanding, and to acturally find "\u{1D122}" character symbol. seems hard when fromCharCode(119074) is not same.
So do the methods produce different UTF sets?
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2020-07-19 14:25 +0100 |
| Message-ID | <87pn8rd4bj.fsf@bsb.me.uk> |
| In reply to | #38534 |
Jonas Thörnvall <jonas.thornvall@gmail.com> writes:
<cut>
> Something is wrong/strange????
> fromCharCode(119074) is not same as "\u{1D122}"
>
> Why is it not same UTF format?
Do you ever read documentation?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-19 07:30 -0700 |
| Message-ID | <4f6f0717-a358-481f-92d8-ea419a68fb27o@googlegroups.com> |
| In reply to | #38541 |
Den söndag 19 juli 2020 kl. 15:25:56 UTC+2 skrev Ben Bacarisse:
> Jonas Thörnvall <jonas.thornvall@gmail.com> writes:
> <cut>
> > Something is wrong/strange????
> > fromCharCode(119074) is not same as "\u{1D122}"
> >
> > Why is it not same UTF format?
>
> Do you ever read documentation?
>
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
>
> --
> Ben.
I am not sure i even understand your objection Ben, i did read it is UTF-16 that generates from a value in range 0-65535.
So exactly what do you refer to?
I am refering to the fact that "\u{1D122}" is not same symbol it as 119074, it should be it is the decimal equivalent of the hexadecimal.
"Or again is it not same UTF charset"?
There is quite possible something that i do not understand about the \u{} notation.
So i am keen to know.
JT
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-19 08:05 -0700 |
| Message-ID | <18e58bf5-3d33-4b6a-afe3-7cc7a715150eo@googlegroups.com> |
| In reply to | #38541 |
Den söndag 19 juli 2020 kl. 15:25:56 UTC+2 skrev Ben Bacarisse:
> Jonas Thörnvall <jonas.thornvall@gmail.com> writes:
> <cut>
> > Something is wrong/strange????
> > fromCharCode(119074) is not same as "\u{1D122}"
> >
> > Why is it not same UTF format?
>
> Do you ever read documentation?
>
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
>
> --
> Ben.
Ok Ben sorry now i found it but the informatin i read was very ambigous, now i see it must be from UTF-32 but it really do not help me write out the symbol/character.
So how should i procede i tried to build the string but JJ say it can't be done.
I will try use String.fromCodePoint() instead and see how that goes.
JT
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-18 13:29 -0700 |
| Message-ID | <e803f5bf-937a-4a9d-8eaa-37f543b43beco@googlegroups.com> |
| In reply to | #38531 |
Den lördag 18 juli 2020 kl. 20:53:15 UTC+2 skrev luserdroog:
> On Saturday, July 18, 2020 at 10:22:54 AM UTC-5, Jonas Thörnvall wrote:
> > Den fredag 17 juli 2020 kl. 00:46:22 UTC+2 skrev luserdroog:
> > > On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
> > > > Den torsdag 16 juli 2020 kl. 18:40:55 UTC+2 skrev JJ:
> > > > > On Thu, 16 Jul 2020 05:22:13 -0700 (PDT), Jonas Thörnvall wrote:
> > > > > > Do anyone have a script to list unicode signs in an interval?
> > > > > >
> > > > > > JT
> > > > >
> > > > > Signs? If you meant symbol/graphical characters, see:
> > > > >
> > > > > https://en.wikipedia.org/wiki/Unicode_symbols
> > > >
> > > > Well i found howto do it i just did wonder if anyone have something to readily do it in table form with a range.
> > > >
> > > > ctm.fillText("\u{1D122}", 100, 250);
> > >
> > > function codes(minCode, maxCode) {
> > > let a = [];
> > > for (var c = minCode; c <= maxCode; ++c) {
> > > a.push(String.fromCharCode(c));
> > > }
> > > return a;
> > > }
> > >
> > > codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
> > >
> > > ?
> >
> > Hello luserdroog could you help me out build an allowed string from
> > ustring='"\u'+hexString+'}"';
> >
> > I thought the above was ok, but it is not.
>
> What's the curly brace for? That doesn't look right. And having the
> double quotes in there also looks clumsy. If I needed that I'd make
> a function wrapQuotes() to just do that part.
>
> But, just use String.fromCharCode(). I have sometimes built unicode
> glyphs by using an html entity.
>
> s = '&#x' + '1D122' + ';';
A little improvement
<HTML>
<BODY BGCOLOR=YELLOW>
<B><font size=5>UNICODE SYMBOLS UTF-16</font>
MIN - <input type="number" id="xmin" name="xmin" value=0 size="10" onChange="setrange()">
MAX<input type="number" id="xmax" name="xmax" value=720 size="10" disabled></B>
<input type="submit" value="Page+" onclick="plus()"> |
<input type="submit" value="Page-" onclick="minus()">
<br>
</BODY>
</HTML>
<canvas id="myCanvas" width="1900" height="890"></canvas>
<script>
var c = document.getElementById("myCanvas");
var ctm = c.getContext("2d");
function plus(){
document.getElementById('xmin').value=min+720;
document.getElementById('xmax').value=max+720;
unicode();
}
function minus(){
if(min>0){
document.getElementById('xmin').value=min-720;
document.getElementById('xmax').value=max-720;
unicode();
}
}
function setrange(){
min=document.getElementById('xmin').value;
min=parseInt(min);
max=min+720;
document.getElementById('xmax').value=max;
unicode();
}
let uniarr = [];
function unicode(){
ctm.fillStyle = "#000000";
ctm.fillRect(0, 0, 1900, 880);
var k=20;
var l=30;
min=document.getElementById('xmin').value;
max=document.getElementById('xmax').value;
min=parseInt(min);
max=parseInt(max);
for(var i=min;i<max; i++){
//hexString = i.toString(16);
//ustring='"\\'+'u{'+hexString+'}"';
//uniarr.push(ustring);
uniarr.push(String.fromCharCode(i));
}
var j=min;
while (j<=max){
ctm.font = "32px courier bold";
ctm.fillStyle = 'white';
ctm.fillText(uniarr[j],k, l );
ctm.font = "12px courier bold";
ctm.fillStyle = 'white';
ctm.fillText(j,k, l+20 );
k=k+40;
j++;
if(k>1800){k=20;l=l+54;};
}
}
unicode();
</script>
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-18 08:32 -0700 |
| Message-ID | <91adaad0-faa3-4369-94fc-e3035ae6f5f6o@googlegroups.com> |
| In reply to | #38515 |
Den fredag 17 juli 2020 kl. 00:46:22 UTC+2 skrev luserdroog:
> On Thursday, July 16, 2020 at 12:18:23 PM UTC-5, Jonas Thörnvall wrote:
> > Den torsdag 16 juli 2020 kl. 18:40:55 UTC+2 skrev JJ:
> > > On Thu, 16 Jul 2020 05:22:13 -0700 (PDT), Jonas Thörnvall wrote:
> > > > Do anyone have a script to list unicode signs in an interval?
> > > >
> > > > JT
> > >
> > > Signs? If you meant symbol/graphical characters, see:
> > >
> > > https://en.wikipedia.org/wiki/Unicode_symbols
> >
> > Well i found howto do it i just did wonder if anyone have something to readily do it in table form with a range.
> >
> > ctm.fillText("\u{1D122}", 100, 250);
>
> function codes(minCode, maxCode) {
> let a = [];
> for (var c = minCode; c <= maxCode; ++c) {
> a.push(String.fromCharCode(c));
> }
> return a;
> }
>
> codes(min, max).forEach( (x,i) => ctm.fillText( x, 100, 250 + 10*i ) );
>
> ?
This sort of string is what i am trying to achieve.
"\u{1D122}"
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.javascript
csiph-web