question 1: THE PROCEDURE tft_write_text_return_pos is missing in the documentation, missing in implementation? pascal for pic 32
question 2: Is it possible to reprogram ILI9341 to start to write from right to left in real time, this will be a nice function to align end of leading text to a point. Alternatives, alignment is problem when using proportional fonts.
ILI9341 - prblems
Re: ILI9341 - prblems
Hi,
Regards,
Filip.
You are right, this function lacks documentation, I will report this to colleague in charge.question 1: THE PROCEDURE tft_write_text_return_pos is missing in the documentation, missing in implementation? pascal for pic 32
Currently this is not supported in the library but I suppose it can be done.question 2: Is it possible to reprogram ILI9341 to start to write from right to left in real time, this will be a nice function to align end of leading text to a point. Alternatives, alignment is problem when using proportional fonts.
Regards,
Filip.
Re: ILI9341 - prblems
As a response to this I made a routine that run trough any font implementation an calculates the real pixel length for a string. By looking at the picture You can see that the "date:" text and downward align nicely to a predefined right position independent of string length. here is the routine:
function _SkrWindowGetPixelLengthStr(var Str : string; AFont : byte) : word;
// ====================================================================================================================
//
// function _SkrWindowGetPixelLength(var Str : string; AFont : byte; var Average : byte) : word;
//
// This routine returns the pixel length of string <Str> by checking pixel length of each character in <AFont>
// implementation.
//
// Added: New, Tested: 16.11.2020 for correct reading of font data
// ====================================================================================================================
// Equation: Pixels :=
//
begin
asm
or R5,R0,R0 // make sure counter is zero
lw R2, offset _FontParametre (GP) // point to first record in array
ori R3,R0,8 // get multiplicator
mult R26,R3 // get bytes to move
mflo R3 // get bytes
add R2,R2,R3 // point to correct position
lw R3,0(R2) // get address to font table
addiu R3,R3,8 // bypass font header
lbu R4,4(R2) // get first character value
GPL_01:
lbu R2,0(R25) // get first character from Str
beq R2,R0,GPL_02 // if terminator, then end
NOP
sub R2,R2,R4 // get position within font array by subtracting first character
sll R2,R2,2 // multiply by 4
add R2,R2,R3 // add to existing address
lbu R6,0(R2) // get number of width pixels for this character
addu R5,R5,R6 // add to counter
addiu R5,R5,1 // add 1 pixel for inter character space
addiu R25,R25,1 // advance string address
b GPL_01 // continue to end
NOP
GPL_02:
end;
result := R5;
end;
function _SkrWindowGetPixelLengthStr(var Str : string; AFont : byte) : word;
// ====================================================================================================================
//
// function _SkrWindowGetPixelLength(var Str : string; AFont : byte; var Average : byte) : word;
//
// This routine returns the pixel length of string <Str> by checking pixel length of each character in <AFont>
// implementation.
//
// Added: New, Tested: 16.11.2020 for correct reading of font data
// ====================================================================================================================
// Equation: Pixels :=
//
begin
asm
or R5,R0,R0 // make sure counter is zero
lw R2, offset _FontParametre (GP) // point to first record in array
ori R3,R0,8 // get multiplicator
mult R26,R3 // get bytes to move
mflo R3 // get bytes
add R2,R2,R3 // point to correct position
lw R3,0(R2) // get address to font table
addiu R3,R3,8 // bypass font header
lbu R4,4(R2) // get first character value
GPL_01:
lbu R2,0(R25) // get first character from Str
beq R2,R0,GPL_02 // if terminator, then end
NOP
sub R2,R2,R4 // get position within font array by subtracting first character
sll R2,R2,2 // multiply by 4
add R2,R2,R3 // add to existing address
lbu R6,0(R2) // get number of width pixels for this character
addu R5,R5,R6 // add to counter
addiu R5,R5,1 // add 1 pixel for inter character space
addiu R25,R25,1 // advance string address
b GPL_01 // continue to end
NOP
GPL_02:
end;
result := R5;
end;
- Attachments
-
- IMG_20201124_135912 (2).jpg (2.41 MiB) Viewed 1207 times