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 | 11 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 2 of 2 — ← Prev page 1 [2]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-18 08:45 -0700 |
| Message-ID | <67f2ad78-faef-4305-9c9c-1644f1ad44e8o@googlegroups.com> |
| In reply to | #38524 |
Den lördag 18 juli 2020 kl. 17:32:54 UTC+2 skrev Jonas Thörnvall:
> 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}"
I just can't figure out howto escape the backslash
ustring='"\\u{'+hexString+'}"';
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-18 09:01 -0700 |
| Message-ID | <c7e40450-03cf-4c20-a2c8-e3259f88e381o@googlegroups.com> |
| In reply to | #38525 |
Den lördag 18 juli 2020 kl. 17:46:04 UTC+2 skrev Jonas Thörnvall:
> Den lördag 18 juli 2020 kl. 17:32:54 UTC+2 skrev Jonas Thörnvall:
> > 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}"
>
> I just can't figure out howto escape the backslash
> ustring='"\\u{'+hexString+'}"';
The script is done just need to build the string.
<HTML>
<BODY BGCOLOR=YELLOW onload=unicode();>
<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=100 size="10"></B>
<input type="submit" value="Page+" onclick="plus()"> |
<input type="submit" value="Page-" onclick="minus()">
<br>
<canvas id="myCanvas" width="1900" height="890"></canvas>
</BODY>
</HTML>
<script>
var c = document.getElementById("myCanvas");
var ctm = c.getContext("2d");
ctm.fillStyle = "#000000";
ctm.fillRect(0, 0, 1890, 880);
function plus(){
document.getElementById('xmin').value=min+890;
document.getElementById('xmax').value=max+890;
unicode();
}
function minus(){
if(min>0){
document.getElementById('xmin').value=min-890;
document.getElementById('xmax').value=max-890;
unicode();
}
}
function unicode(){
var k=60;
var l=60;
min=document.getElementById('xmin').value;
max=document.getElementById('xmax').value;
min=parseInt(min);
max=parseInt(max);
let uniarr = [];
for(var i=min;i<max; i++){
hexString = i.toString(16);
ustring='"'+'\\'+'u{'+hexString+'}"';
uniarr.push(ustring);
}
ctm.font = "35px courier bold";
ctm.fillStyle = 'white';
var j=min;
while (j<max){
ctm.fillText( uniarr[j],k, l );
k=k+40;
j++;
if(k>1800){k=40;l=l+40;};
}
}
</script>
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-18 09:44 -0700 |
| Message-ID | <3faeeda8-c7a0-4853-83d3-964734253b22o@googlegroups.com> |
| In reply to | #38526 |
Den lördag 18 juli 2020 kl. 18:01:33 UTC+2 skrev Jonas Thörnvall:
> Den lördag 18 juli 2020 kl. 17:46:04 UTC+2 skrev Jonas Thörnvall:
> > Den lördag 18 juli 2020 kl. 17:32:54 UTC+2 skrev Jonas Thörnvall:
> > > 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}"
> >
> > I just can't figure out howto escape the backslash
> > ustring='"\\u{'+hexString+'}"';
>
> The script is done just need to build the string.
> <HTML>
> <BODY BGCOLOR=YELLOW onload=unicode();>
> <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=100 size="10"></B>
> <input type="submit" value="Page+" onclick="plus()"> |
> <input type="submit" value="Page-" onclick="minus()">
> <br>
> <canvas id="myCanvas" width="1900" height="890"></canvas>
> </BODY>
> </HTML>
>
> <script>
> var c = document.getElementById("myCanvas");
> var ctm = c.getContext("2d");
> ctm.fillStyle = "#000000";
> ctm.fillRect(0, 0, 1890, 880);
>
> function plus(){
> document.getElementById('xmin').value=min+890;
> document.getElementById('xmax').value=max+890;
> unicode();
> }
>
> function minus(){
> if(min>0){
> document.getElementById('xmin').value=min-890;
> document.getElementById('xmax').value=max-890;
> unicode();
> }
> }
>
> function unicode(){
> var k=60;
> var l=60;
> min=document.getElementById('xmin').value;
> max=document.getElementById('xmax').value;
> min=parseInt(min);
> max=parseInt(max);
> let uniarr = [];
> for(var i=min;i<max; i++){
> hexString = i.toString(16);
> ustring='"'+'\\'+'u{'+hexString+'}"';
> uniarr.push(ustring);
> }
> ctm.font = "35px courier bold";
> ctm.fillStyle = 'white';
> var j=min;
> while (j<max){
> ctm.fillText( uniarr[j],k, l );
> k=k+40;
> j++;
> if(k>1800){k=40;l=l+40;};
> }
> }
> </script>
When i alert ustring the correct string seem to be there?
If i just replaced uniarr[j] with the actual string it stores it would work?
What am i missing here.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-18 10:03 -0700 |
| Message-ID | <3a4577ca-c9e0-4527-9412-32fd6559f816o@googlegroups.com> |
| In reply to | #38527 |
Den lördag 18 juli 2020 kl. 18:44:08 UTC+2 skrev Jonas Thörnvall:
> Den lördag 18 juli 2020 kl. 18:01:33 UTC+2 skrev Jonas Thörnvall:
> > Den lördag 18 juli 2020 kl. 17:46:04 UTC+2 skrev Jonas Thörnvall:
> > > Den lördag 18 juli 2020 kl. 17:32:54 UTC+2 skrev Jonas Thörnvall:
> > > > 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}"
> > >
> > > I just can't figure out howto escape the backslash
> > > ustring='"\\u{'+hexString+'}"';
> >
> > The script is done just need to build the string.
> > <HTML>
> > <BODY BGCOLOR=YELLOW onload=unicode();>
> > <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=100 size="10"></B>
> > <input type="submit" value="Page+" onclick="plus()"> |
> > <input type="submit" value="Page-" onclick="minus()">
> > <br>
> > <canvas id="myCanvas" width="1900" height="890"></canvas>
> > </BODY>
> > </HTML>
> >
> > <script>
> > var c = document.getElementById("myCanvas");
> > var ctm = c.getContext("2d");
> > ctm.fillStyle = "#000000";
> > ctm.fillRect(0, 0, 1890, 880);
> >
> > function plus(){
> > document.getElementById('xmin').value=min+890;
> > document.getElementById('xmax').value=max+890;
> > unicode();
> > }
> >
> > function minus(){
> > if(min>0){
> > document.getElementById('xmin').value=min-890;
> > document.getElementById('xmax').value=max-890;
> > unicode();
> > }
> > }
> >
> > function unicode(){
> > var k=60;
> > var l=60;
> > min=document.getElementById('xmin').value;
> > max=document.getElementById('xmax').value;
> > min=parseInt(min);
> > max=parseInt(max);
> > let uniarr = [];
> > for(var i=min;i<max; i++){
> > hexString = i.toString(16);
> > ustring='"'+'\\'+'u{'+hexString+'}"';
> > uniarr.push(ustring);
> > }
> > ctm.font = "35px courier bold";
> > ctm.fillStyle = 'white';
> > var j=min;
> > while (j<max){
> > ctm.fillText( uniarr[j],k, l );
> > k=k+40;
> > j++;
> > if(k>1800){k=40;l=l+40;};
> > }
> > }
> > </script>
>
> When i alert ustring the correct string seem to be there?
> If i just replaced uniarr[j] with the actual string it stores it would work?
> What am i missing here.
Fast check anyone?
<HTML>
<canvas id="myCanvas" width="1900" height="890"></canvas>
<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=889 size="10"></B>
<input type="submit" value="Page+" onclick="plus()"> |
<input type="submit" value="Page-" onclick="minus()">
<br>
</BODY>
</HTML>
<script>
var c = document.getElementById("myCanvas");
var ctm = c.getContext("2d");
ctm.fillStyle = "#000000";
ctm.fillRect(0, 0, 1890, 880);
function plus(){
document.getElementById('xmin').value=min+890;
document.getElementById('xmax').value=max+890;
unicode();
}
function minus(){
if(min>0){
document.getElementById('xmin').value=min-890;
document.getElementById('xmax').value=max-890;
unicode();
}
}
function unicode(){
var k=60;
var l=60;
min=document.getElementById('xmin').value;
max=document.getElementById('xmax').value;
min=parseInt(min);
max=parseInt(max);
let uniarr = [];
for(var i=min;i<max; i++){
hexString = i.toString(16);
ustring='"'+'\\'+'u{'+hexString+'}"';
uniarr.push(ustring);
}
ctm.font = "35px courier bold";
ctm.fillStyle = 'white';
var j=min;
while (j<max){
//ctm.fillText( "\u{45}",k, l );
ctm.fillText(uniarr[j],k, l );
//alert(uniarr[j]);
k=k+40;
j++;
if(k>1800){k=40;l=l+40;};
}
}
unicode();
</script>
[toc] | [prev] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2020-07-19 20:47 +0700 |
| Message-ID | <40irtjzhnqkw$.qzm3alh1hfc7$.dlg@40tude.net> |
| In reply to | #38525 |
On Sat, 18 Jul 2020 08:45:58 -0700 (PDT), Jonas Thörnvall wrote:
>
> I just can't figure out howto escape the backslash
> ustring='"\\u{'+hexString+'}"';
It's not possible to dynamically create a `\u` or `\x` escaped character
where the character code is from separate source. Unless `eval()` or similar
method is used.
Use `String.fromCodePoint()` instead.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-19 07:41 -0700 |
| Message-ID | <3d843ce0-e45b-4e66-ae73-86fb19219889o@googlegroups.com> |
| In reply to | #38542 |
Den söndag 19 juli 2020 kl. 15:47:14 UTC+2 skrev JJ:
> On Sat, 18 Jul 2020 08:45:58 -0700 (PDT), Jonas Thörnvall wrote:
> >
> > I just can't figure out howto escape the backslash
> > ustring='"\\u{'+hexString+'}"';
>
> It's not possible to dynamically create a `\u` or `\x` escaped character
> where the character code is from separate source. Unless `eval()` or similar
> method is used.
>
> Use `String.fromCodePoint()` instead.
Hello JJ, if you search "UTF-16 music symbols" for example you get this.
"UTF music symbols"
Unicode Character “𝅘𝅥𝅯” (U+1D161)
Name: Musical Symbol Sixteenth Note
HTML Entity: 𝅘𝅥𝅯 𝅘𝅥𝅯
UTF-8 Encoding: 0xF0 0x9D 0x85 0xA1
UTF-16 Encoding: 0xD834 0xDD61
UTF-32 Encoding: 0x0001D161
I really do not care about where the fromCharCode is store but it sure ain't stored at the place of making above decimal.
I can use charcode no problem but where are they stored????
I scrolled quite a bit.
Or better show me the line of code using stringFromCodePoint that generate Sixteenth Note and i am on my way to much more interesting tasks.
"Like generate realtime notation when playing, "well you have to release key for me to know placement and length relative tempo and then i can write out the note in realtime"
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-19 09:41 -0700 |
| Message-ID | <2d65a581-c20d-4174-9523-1bb10aa181f0o@googlegroups.com> |
| In reply to | #38542 |
Den söndag 19 juli 2020 kl. 15:47:14 UTC+2 skrev JJ:
> On Sat, 18 Jul 2020 08:45:58 -0700 (PDT), Jonas Thörnvall wrote:
> >
> > I just can't figure out howto escape the backslash
> > ustring='"\\u{'+hexString+'}"';
>
> It's not possible to dynamically create a `\u` or `\x` escaped character
> where the character code is from separate source. Unless `eval()` or similar
> method is used.
>
> Use `String.fromCodePoint()` instead.
Hello JJ, thanks for trying but 119704 using
uniarr.push(String.fromCodePoint(i));
Still just produce a rectangle.
So it is not the same charset UTF-32?
[toc] | [prev] | [next] | [standalone]
| From | luserdroog <luser.droog@gmail.com> |
|---|---|
| Date | 2020-07-19 11:53 -0700 |
| Message-ID | <5a10a2a5-52ed-4c98-8880-7bd0840f71cbo@googlegroups.com> |
| In reply to | #38549 |
On Sunday, July 19, 2020 at 11:42:01 AM UTC-5, Jonas Thörnvall wrote:
> Den söndag 19 juli 2020 kl. 15:47:14 UTC+2 skrev JJ:
> > On Sat, 18 Jul 2020 08:45:58 -0700 (PDT), Jonas Thörnvall wrote:
> > >
> > > I just can't figure out howto escape the backslash
> > > ustring='"\\u{'+hexString+'}"';
> >
> > It's not possible to dynamically create a `\u` or `\x` escaped character
> > where the character code is from separate source. Unless `eval()` or similar
> > method is used.
> >
> > Use `String.fromCodePoint()` instead.
>
> Hello JJ, thanks for trying but 119704 using
> uniarr.push(String.fromCodePoint(i));
> Still just produce a rectangle.
> So it is not the same charset UTF-32?
It could be that the glyph is not present in the current font.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-19 12:00 -0700 |
| Message-ID | <5d5af542-a040-4983-8293-58fe2885a153o@googlegroups.com> |
| In reply to | #38550 |
Den söndag 19 juli 2020 kl. 20:53:52 UTC+2 skrev luserdroog:
> On Sunday, July 19, 2020 at 11:42:01 AM UTC-5, Jonas Thörnvall wrote:
> > Den söndag 19 juli 2020 kl. 15:47:14 UTC+2 skrev JJ:
> > > On Sat, 18 Jul 2020 08:45:58 -0700 (PDT), Jonas Thörnvall wrote:
> > > >
> > > > I just can't figure out howto escape the backslash
> > > > ustring='"\\u{'+hexString+'}"';
> > >
> > > It's not possible to dynamically create a `\u` or `\x` escaped character
> > > where the character code is from separate source. Unless `eval()` or similar
> > > method is used.
> > >
> > > Use `String.fromCodePoint()` instead.
> >
> > Hello JJ, thanks for trying but 119704 using
> > uniarr.push(String.fromCodePoint(i));
> > Still just produce a rectangle.
> > So it is not the same charset UTF-32?
>
> It could be that the glyph is not present in the current font.
No it is there try it yourself.
<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=719 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.fromCodePoint(i));
}
var j=min;
while (j<=max){
ctm.font = "32px courier bold";
ctm.fillStyle = 'white';
//ctm.fillText(uniarr[j],k, l );
ctm.fillText("\u{1D122}", 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 | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2020-07-19 20:58 +0100 |
| Message-ID | <87v9ijp98l.fsf@bsb.me.uk> |
| In reply to | #38549 |
Jonas Thörnvall <jonas.thornvall@gmail.com> writes:
> Den söndag 19 juli 2020 kl. 15:47:14 UTC+2 skrev JJ:
>> On Sat, 18 Jul 2020 08:45:58 -0700 (PDT), Jonas Thörnvall wrote:
>> >
>> > I just can't figure out howto escape the backslash
>> > ustring='"\\u{'+hexString+'}"';
>>
>> It's not possible to dynamically create a `\u` or `\x` escaped character
>> where the character code is from separate source. Unless `eval()` or similar
>> method is used.
>>
>> Use `String.fromCodePoint()` instead.
>
> Hello JJ, thanks for trying but 119704 using
119704 is not 0x1d122. That's 119074.
$ nodejs
> String.fromCodePoint(119074) === "\u{1d122}"
true
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2020-07-19 14:17 -0700 |
| Message-ID | <53e86aab-f54d-4145-8921-c12576e1613do@googlegroups.com> |
| In reply to | #38552 |
Den söndag 19 juli 2020 kl. 21:58:54 UTC+2 skrev Ben Bacarisse:
> Jonas Thörnvall <jonas.thornvall@gmail.com> writes:
>
> > Den söndag 19 juli 2020 kl. 15:47:14 UTC+2 skrev JJ:
> >> On Sat, 18 Jul 2020 08:45:58 -0700 (PDT), Jonas Thörnvall wrote:
> >> >
> >> > I just can't figure out howto escape the backslash
> >> > ustring='"\\u{'+hexString+'}"';
> >>
> >> It's not possible to dynamically create a `\u` or `\x` escaped character
> >> where the character code is from separate source. Unless `eval()` or similar
> >> method is used.
> >>
> >> Use `String.fromCodePoint()` instead.
> >
> > Hello JJ, thanks for trying but 119704 using
>
> 119704 is not 0x1d122. That's 119074.
>
> $ nodejs
> > String.fromCodePoint(119074) === "\u{1d122}"
> true
>
> --
> Ben.
Yeah you are correct Ben it is working, thanks JJ thanks luserdroog thanks Ban.
Problem solved,
JT
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.javascript
csiph-web