Closed wezm closed 2 years ago
Sounds very interesting, the 7-segment style looks beautiful. I will be very happy to accept the contribution.
BTW, I was thinking about support more styles but failed. Curious how you plan to implement it? Appreciate if you want to share more details before you start.
BTW, I was thinking about support more styles but failed. Curious how you plan to implement it? Appreciate if you want to share more details before you start.
I was thinking something along these lines but have not verified in detail if it will work:
font
property to App
, which clock, timer, etc receive and store as they do style.font
might be an enum like:
enum Font {
Bricks,
SevenSegment
}
BricksText::new
is currently called that could become:
font.new(time_str, self.size, self.size, self.style)
, which returns FontText
:
enum FontText {
Bricks(BricksText),
SevenSegment(SevenSegment)
}
SevenSegment
is a new struct that has a Widget
impl like BricksText
.text
argument to render_centered
is changed to take &FontText
FontText
would have a Widget
impl that forwards to the inner widget (BricksText
or SevenSegment
)The abstraction of Font
looks great, love it.
In addition to this, my question is what the SevenSegment
font looks like? Considering that the terminal are all text chars, we can think of each char as a pixel, it seems very difficult to render each segment of as long hexagon (highlighted on blue oval bellow):
Ahh I wasn't going to do anything special to render the seven-segment digits. I was thinking it would just output the digits as text (using the Unicode codepoints) like 🯱:🯲🯳 and zoom the font size of the terminal window to make them bigger.
I see, thanks for the explanation, but it seems that It's not what I thought. I want to share some thoughts about the design of this tool:
Based on these premises, I choose to use character bricks to compose big digitals, and I suppose the original 7-segment display characters is not case. How do you think about it?
Based on these premises, I choose to use character bricks to compose big digitals, and I suppose the original 7-segment display characters is not case. How do you think about it?
Thanks for sharing the design of the tool, that makes a lot of sense. With this in mind it seems I am perhaps trying to use the clock in a way it was not designed, so perhaps it is not right to add the seven-segement feature. I'm using the timer in large text but for the clock I just want a small clock in the corner of my screen. I might build this as a separate project.
Awesome, your use case sounds very interesting, looking forward to your project!
I built the clock, probably should add an option to set the colour (I added colour support) but it seems to work. https://github.com/wezm/7clock
Unicode 13 added these 7-segment display characters:
🯰 🯱 🯲 🯳 🯴 🯵 🯶 🯷 🯸 🯹 (Image in case they aren't appearing: )
I was thinking about adding a
--style
/-S
option to let you choose the letter style between the brick chars and 7-segment chars.Before I work on this I was wondering if this was contribution you'd be interested in accepting?