Skip to content

Commit a5e63b8

Browse files
Melhoria na fonte
1 parent 50ac73e commit a5e63b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+5002
-2894
lines changed
148 Bytes
Binary file not shown.

Distro/Linux64/Plataformas/8086/System.Drawing.hcb

Lines changed: 82 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Structure VideoMode
99
Dim DrawEllipse as Action(Of VideoMode, UInt16, UInt16, UInt16, UInt16, UInt16, UInt16)
1010
Dim DrawLine as Action(Of VideoMode, UInt16, UInt16, UInt16, UInt16, UInt16)
1111
Dim ClearScreen as Action(Of VideoMode, UInt16)
12+
Dim Refresh as Action(Of VideoMode, UInt16)
1213
End
1314

1415
Structure Size
@@ -29,6 +30,17 @@ Structure Font
2930
Dim CalcSize as Action(Of Font, PtrByteArray, Size, UInt16, UInt16)
3031
End
3132

33+
Structure FontChar
34+
Dim Char as PtrByteArray
35+
Dim CharX as PtrByteArray
36+
Dim Above as PtrByteArray
37+
Dim AboveX as PtrByteArray
38+
Dim Below as PtrByteArray
39+
Dim BelowX as PtrByteArray
40+
Dim HasAbove as UInt8
41+
Dim HasBellow as UInt8
42+
End
43+
3244
Module Graphics
3345
Dim Active as UInt16
3446
Dim Video as VideoMode
@@ -118,6 +130,11 @@ Module Graphics
118130
Font.Initialize
119131
End
120132

133+
Public Sub Refresh()
134+
If Active == 0 Then Throw AccessDeniedError
135+
Video.Refresh.Invoke
136+
End
137+
121138
End
122139

123140
Module GenericVideo
@@ -317,10 +334,62 @@ Module Font
317334
Return ptrChar
318335
End
319336

337+
Function ConvertCharToFont(font as Font, char as FontChar, text as PtrByteArray, pos as UInt16) as UInt16
338+
Dim index as UInt16
339+
Dim aboveIndex as UInt16
340+
Dim belowIndex as UInt16
341+
342+
index = 0
343+
aboveIndex = 0
344+
belowIndex = 0
345+
@text = @text + pos
346+
347+
If (text >= 0x30) AndAlso (text <= 0x39) Then
348+
index = text - 0x30 + 2
349+
Goto charfontend
350+
End
351+
If (text >= 0x41) AndAlso (text <= 0x5a) Then
352+
index = text - 0x41 + 12
353+
Goto charfontend
354+
End
355+
If (text >= 0x61) AndAlso (text <= 0x7a) Then
356+
index = text - 0x61 + 38
357+
Goto charfontend
358+
End
359+
If text == 0x20 Then
360+
index = 1
361+
Goto charfontend
362+
End
363+
If text == 0xc3 Then
364+
@text++
365+
pos++
366+
If text == 0xb3 Then
367+
index = 26
368+
aboveIndex = 74
369+
Goto charfontend
370+
End
371+
End
372+
charfontend:
373+
If aboveIndex <> 0 Then
374+
char.HasAbove = 1
375+
char.Above = FindChar(font, aboveIndex)
376+
Else
377+
char.HasAbove = 0
378+
End
379+
If belowIndex <> 0 Then
380+
char.HasBellow = 1
381+
char.Below = FindChar(font, belowIndex)
382+
Else
383+
char.HasBellow = 0
384+
End
385+
char.Char = FindChar(font, index)
386+
pos++
387+
Return pos
388+
End
389+
320390
Sub DrawText(font as Font, text as PtrByteArray, x1 as UInt16, y1 as UInt16, x2 as UInt16, y2 as UInt16, color as UInt16, multiline as UInt16)
321391
Dim ptrChar as PtrByteArray
322392
Dim len as UInt16
323-
Dim index as UInt16
324393
Dim width as UInt16
325394
Dim maxBytes as UInt16
326395
Dim subWidth as UInt16
@@ -333,22 +402,16 @@ Module Font
333402
Dim yCalc as UInt16
334403
Dim xCalc as UInt16
335404
Dim tmp as UInt16
336-
Dim useAbove as UInt16
337-
Dim useBelow as UInt16
338405
Dim totalWidth as UInt16
406+
Dim fontChar as FontChar
407+
fontChar = New
339408
totalWidth = x2 - x1
340409
len = String.Length(text)
341-
@text++
342410
x = 0
343-
For pos = 1 to len
344-
useAbove = 0
345-
useBelow = 0
346-
index = 0
347-
If (text >= 0x30) andalso (text <= 0x39) Then index = text - 0x30 + 2
348-
If (text >= 0x41) andalso (text <= 0x5a) Then index = text - 0x41 + 12
349-
If (text >= 0x61) andalso (text <= 0x7a) Then index = text - 0x61 + 12
350-
If text == 0x20 Then index = 1
351-
ptrChar = FindChar(font, index)
411+
pos = 1
412+
While pos <= len
413+
pos = ConvertCharToFont(font, fontChar, text, pos)
414+
ptrChar = fontChar.Char
352415
width = ptrChar
353416
@ptrChar++
354417
extraOffset = ptrChar
@@ -386,14 +449,12 @@ Module Font
386449
End
387450
End
388451
x = x + width + font.Spacing
389-
@text++
390452
End
391453
End
392454

393455
Sub CalcSize(font as Font, text as PtrByteArray, output as Size, totalWidth as UInt16, multiline as UInt16)
394456
Dim ptrChar as PtrByteArray
395457
Dim len as UInt16
396-
Dim index as UInt16
397458
Dim width as UInt16
398459
Dim maxBytes as UInt16
399460
Dim subWidth as UInt16
@@ -409,18 +470,16 @@ Module Font
409470
Dim useAbove as UInt16
410471
Dim useBelow as UInt16
411472
Dim newLine as UInt16
473+
Dim fontChar as FontChar
474+
fontChar = New
412475
newLine = 0
413476
len = String.Length(text)
414-
@text++
415477
x = 0
416478
output.Height = font.Height
417-
For pos = 1 to len
418-
index = 0
419-
If (text >= 0x30) andalso (text <= 0x39) Then index = text - 0x30 + 2
420-
If (text >= 0x41) andalso (text <= 0x5a) Then index = text - 0x41 + 12
421-
If (text >= 0x61) andalso (text <= 0x7a) Then index = text - 0x61 + 12
422-
If text == 0x20 Then index = 1
423-
ptrChar = FindChar(font, index)
479+
pos = 1
480+
While pos <= len
481+
pos = ConvertCharToFont(font, fontChar, text, pos)
482+
ptrChar = fontChar.Char
424483
width = ptrChar
425484
If (x + width) > totalWidth Then
426485
If multiline Then
@@ -434,7 +493,6 @@ Module Font
434493
End
435494
x = x + width + font.Spacing
436495
If newLine == 0 Then output.Width = x
437-
@text++
438496
End
439497
End
440498
End

Distro/Linux64/Plataformas/8086/System.Forms.hcb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,14 +270,14 @@ Module Control
270270
Public Sub Focus(ctrl as Control)
271271
Dim old as Control
272272
old = Application.CurrentFocus
273+
Application.CurrentFocus = ctrl
274+
ctrl.HasFocus = 1
275+
ctrl.ControlFocusChanged.Invoke 1
273276
If #old <> 0 Then
274277
old.HasFocus = 0
275278
old.ControlFocusChanged.Invoke 0
276279
If old.RedrawOnFocusChanged Then Redraw old
277280
End
278-
Application.CurrentFocus = ctrl
279-
ctrl.HasFocus = 1
280-
ctrl.ControlFocusChanged.Invoke 1
281281
If ctrl.RedrawOnFocusChanged Then Redraw ctrl
282282
End
283283

@@ -312,6 +312,8 @@ Module Control
312312
Public Sub Show(ctrl as Control)
313313
If ctrl.HasParent == 0 Then
314314
Add Screen.ScreenControl, ctrl
315+
Application.CurrentFocus = ctrl
316+
Application.CurrentFocusForm = ctrl
315317
End
316318
ctrl.Visible = 1
317319
Dim parent as Control
@@ -495,11 +497,13 @@ Module Form
495497
leftText = ctrl.CalcX1 + ((ctrl.CalcWidth - size.Width) SHR 1)
496498
rightText = ctrl.CalcX2 - ((ctrl.CalcWidth - size.Width) SHR 1)
497499
Graphics.DrawText fnt, ctrl.Text, leftText, ctrl.CalcY1+1, rightText, ctrl.CalcY1+1+fnt.Height, SystemColors.WindowTitleColor(), 0
498-
For i = ctrl.CalcY1 + 4 to ctrl.CalcY1 + fnt.Height - 3
499-
Graphics.DrawLine ctrl.CalcX1 + 2, i, ctrl.CalcX1 + 3, i, SystemColors.WindowBorderColor()
500-
Graphics.DrawLine ctrl.CalcX1 + 13, i, leftText - 5, i, SystemColors.WindowBorderColor()
501-
Graphics.DrawLine rightText + 4, i, ctrl.CalcX2 - 2, i, SystemColors.WindowBorderColor()
502-
i++
500+
If (#ctrl == #Application.CurrentFocusForm) And (@ctrl == @Application.CurrentFocusForm) Then
501+
For i = ctrl.CalcY1 + 4 to ctrl.CalcY1 + fnt.Height - 3
502+
Graphics.DrawLine ctrl.CalcX1 + 2, i, ctrl.CalcX1 + 3, i, SystemColors.WindowBorderColor()
503+
Graphics.DrawLine ctrl.CalcX1 + 13, i, leftText - 5, i, SystemColors.WindowBorderColor()
504+
Graphics.DrawLine rightText + 4, i, ctrl.CalcX2 - 2, i, SystemColors.WindowBorderColor()
505+
i++
506+
End
503507
End
504508
Graphics.DrawRectangle ctrl.CalcX1 + 5, ctrl.CalcY1 + 4, ctrl.CalcX1 + 11, ctrl.CalcY1 + fnt.Height -3, SystemColors.WindowBorderColor(),SystemColors.WindowColor()
505509
ctrl.PaddingTop = 2 + fnt.Height

Distro/Linux64/Plataformas/Font.asm

Lines changed: 125 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,45 @@ dw wmai
4343
dw xmai
4444
dw ymai
4545
dw zmai ' 37
46-
46+
dw amai ' 38
47+
dw bmai
48+
dw cmai
49+
dw dmai
50+
dw emai
51+
dw fmai
52+
dw gmai
53+
dw hmai
54+
dw imai
55+
dw jmai
56+
dw kmai
57+
dw lmai
58+
dw mmai
59+
dw nmai
60+
dw omai
61+
dw pmai
62+
dw qmai
63+
dw rmai
64+
dw smai
65+
dw tmai
66+
dw umai
67+
dw vmai
68+
dw wmai
69+
dw xmai
70+
dw ymai
71+
dw zmai ' 63
72+
dw agudo ' 64
73+
dw grave ' 65
74+
dw agudo_duplo ' 66
75+
dw grave_duplo ' 67
76+
dw til ' 68
77+
dw circunflexo ' 69
78+
dw macron ' 70
79+
dw braquia ' 71
80+
dw braquia_invertida ' 72
81+
dw caron ' 73
82+
dw anel ' 74
83+
dw cedilha ' 75
84+
dw gancho_polaco ' 76
4785

4886
nome:
4987
db .fim - $
@@ -433,4 +471,89 @@ db 0b00001000
433471
db 0b00010000
434472
db 0b00100000
435473
db 0b01000000
436-
db 0b11111110
474+
db 0b11111110
475+
476+
477+
agudo:
478+
db 2, 0
479+
db 0b01000000
480+
db 0b10000000
481+
db 0b00000000
482+
483+
grave:
484+
db 2, 0
485+
db 0b10000000
486+
db 0b01000000
487+
db 0b00000000
488+
489+
agudo_duplo:
490+
db 5, 0
491+
db 0b01001000
492+
db 0b10010000
493+
db 0b00000000
494+
495+
grave_duplo:
496+
db 5, 0
497+
db 0b10010000
498+
db 0b01001000
499+
db 0b00000000
500+
501+
til:
502+
db 5, 0
503+
db 0b01001000
504+
db 0b10110000
505+
db 0b00000000
506+
507+
circunflexo:
508+
db 3, 0
509+
db 0b01000000
510+
db 0b10100000
511+
db 0b00000000
512+
513+
macron:
514+
db 3, 0
515+
db 0b00000000
516+
db 0b11100000
517+
db 0b00000000
518+
519+
braquia:
520+
db 4, 0
521+
db 0b10010000
522+
db 0b01100000
523+
db 0b00000000
524+
525+
braquia_invertida:
526+
db 4, 0
527+
db 0b01100000
528+
db 0b10010000
529+
db 0b00000000
530+
531+
caron:
532+
db 3, 0
533+
db 0b10100000
534+
db 0b01000000
535+
db 0b00000000
536+
537+
trema:
538+
db 3, 0
539+
db 0b00000000
540+
db 0b10100000
541+
db 0b00000000
542+
543+
anel:
544+
db 4, 0
545+
db 0b01100000
546+
db 0b10010000
547+
db 0b01100000
548+
549+
cedilha:
550+
db 3, 0
551+
db 0b00100000
552+
db 0b10010000
553+
db 0b01100000
554+
555+
gancho_polaco:
556+
db 3, 0
557+
db 0b01000000
558+
db 0b10010000
559+
db 0b01100000
148 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)