Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
esp8266-oled-ssd1306
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
c3pb
esp8266-oled-ssd1306
Commits
dfc7a1d9
Commit
dfc7a1d9
authored
7 years ago
by
Xavier
Browse files
Options
Downloads
Patches
Plain Diff
Now generating the non-displayable character optimisation. Better hexa formatting
parent
d77a5c0d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
resources/glyphEditor.html
+16
-6
16 additions, 6 deletions
resources/glyphEditor.html
with
16 additions
and
6 deletions
resources/glyphEditor.html
+
16
−
6
View file @
dfc7a1d9
...
...
@@ -227,8 +227,9 @@ const char My_Font[] PROGMEM = {
}
// Return anInt as hex string
static
toHexString
(
anInt
)
{
return
`0x
${
anInt
.
toString
(
16
)}
`
static
toHexString
(
aByte
)
{
let
zero
=
aByte
<
16
?
'
0
'
:
''
;
return
`0x
${
zero
}${
aByte
.
toString
(
16
).
toUpperCase
()}
`
}
// Return least significant byte as hex string
...
...
@@ -272,6 +273,7 @@ const char My_Font[] PROGMEM = {
let
charBytes
=
[];
let
charCode
=
chars
[
ch
].
getAttribute
(
'
code
'
);
let
rows
=
chars
[
ch
].
getElementsByTagName
(
'
tr
'
);
let
notZero
=
false
;
// Browse each column
for
(
let
col
=
0
;
col
<
this
.
width
;
col
++
)
{
let
bits
=
""
;
// using string because js uses 32b ints when performing bit operations
...
...
@@ -292,6 +294,9 @@ const char My_Font[] PROGMEM = {
for
(
let
b
=
bits
.
length
-
1
;
b
>=
7
;
b
-=
8
)
{
//Font.output('data', ` // ${bits.substring(b-7, b)}`); // Debugging help: rotated bitmap
let
byte
=
parseInt
(
bits
.
substring
(
b
-
8
,
b
),
2
);
if
(
byte
!=
0
)
{
notZero
=
true
;
}
charBytes
.
push
(
Font
.
toHexString
(
byte
));
}
}
...
...
@@ -300,13 +305,18 @@ const char My_Font[] PROGMEM = {
charBytes
.
pop
();
}
Font
.
output
(
'
data
'
,
`
${
charBytes
.
join
(
'
,
'
)}
, //
${
charCode
}
`
);
// TODO: last param width is not the best value. Need to compute the actual occupied width
Font
.
output
(
'
jump
'
,
`
${
Font
.
getMsB
(
charAddr
)}
,
${
Font
.
getLsB
(
charAddr
)}
,
${
Font
.
toHexString
(
charBytes
.
length
)}
,
${
Font
.
toHexString
(
this
.
width
)}
, //
${
charCode
}
`
);
charAddr
+=
charBytes
.
length
;
if
(
notZero
)
{
Font
.
output
(
'
data
'
,
`
${
charBytes
.
join
(
'
,
'
)}
, //
${
charCode
}
`
);
// TODO: last param width is not the best value. Need to compute the actual occupied width
Font
.
output
(
'
jump
'
,
`
${
Font
.
getMsB
(
charAddr
)}
,
${
Font
.
getLsB
(
charAddr
)}
,
${
Font
.
toHexString
(
charBytes
.
length
)}
,
${
Font
.
toHexString
(
this
.
width
)}
, //
${
charCode
}
`
);
charAddr
+=
charBytes
.
length
;
}
else
{
Font
.
output
(
'
jump
'
,
` 0xff, 0xff, 0x00,
${
Font
.
toHexString
(
this
.
width
)}
, //
${
charCode
}
`
);
}
}
Font
.
output
(
'
data
'
,
'
};
'
);
Font
.
output
(
'
header
'
,
"
// Font generated or edited with the glyphEditor
"
);
Font
.
output
(
'
header
'
,
`const char
${
name
}
[] PROGMEM = {`
);
// Comments are used when parsing back a generated font
Font
.
output
(
'
header
'
,
`
${
Font
.
toHexString
(
this
.
width
)}
, // Width:
${
this
.
width
}
`
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment