mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 00:05:59 +08:00
repace nvgFontFace with nvgFontFaceId (#1279)
This commit is contained in:
+13
-13
@@ -477,7 +477,7 @@ static void ui_draw_vision_maxspeed(UIState *s) {
|
||||
|
||||
// Draw "MAX" Text
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE);
|
||||
nvgFontFace(s->vg, "sans-regular");
|
||||
nvgFontFaceId(s->vg, s->font_sans_regular);
|
||||
nvgFontSize(s->vg, 26*2.5);
|
||||
if (is_cruise_set) {
|
||||
nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 200));
|
||||
@@ -487,14 +487,14 @@ static void ui_draw_vision_maxspeed(UIState *s) {
|
||||
nvgText(s->vg, viz_maxspeed_x+(viz_maxspeed_xo/2)+(viz_maxspeed_w/2), 148, "MAX", NULL);
|
||||
|
||||
// Draw Speed Text
|
||||
nvgFontFace(s->vg, "sans-bold");
|
||||
nvgFontFaceId(s->vg, s->font_sans_bold);
|
||||
nvgFontSize(s->vg, 48*2.5);
|
||||
if (is_cruise_set) {
|
||||
snprintf(maxspeed_str, sizeof(maxspeed_str), "%d", maxspeed_calc);
|
||||
nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 255));
|
||||
nvgText(s->vg, viz_maxspeed_x+(viz_maxspeed_xo/2)+(viz_maxspeed_w/2), 242, maxspeed_str, NULL);
|
||||
} else {
|
||||
nvgFontFace(s->vg, "sans-semibold");
|
||||
nvgFontFaceId(s->vg, s->font_sans_semibold);
|
||||
nvgFontSize(s->vg, 42*2.5);
|
||||
nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 100));
|
||||
nvgText(s->vg, viz_maxspeed_x+(viz_maxspeed_xo/2)+(viz_maxspeed_w/2), 242, "N/A", NULL);
|
||||
@@ -560,7 +560,7 @@ static void ui_draw_vision_speedlimit(UIState *s) {
|
||||
|
||||
// Draw "Speed Limit" Text
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE);
|
||||
nvgFontFace(s->vg, "sans-semibold");
|
||||
nvgFontFaceId(s->vg, s->font_sans_semibold);
|
||||
nvgFontSize(s->vg, 50);
|
||||
nvgFillColor(s->vg, nvgRGBA(0, 0, 0, 255));
|
||||
if (is_speedlim_valid && s->is_ego_over_limit) {
|
||||
@@ -570,7 +570,7 @@ static void ui_draw_vision_speedlimit(UIState *s) {
|
||||
nvgText(s->vg, viz_speedlim_x+viz_speedlim_w/2 + (is_speedlim_valid ? 6 : 0), viz_speedlim_y + (is_speedlim_valid ? 90 : 85), "SPEED", NULL);
|
||||
|
||||
// Draw Speed Text
|
||||
nvgFontFace(s->vg, "sans-bold");
|
||||
nvgFontFaceId(s->vg, s->font_sans_bold);
|
||||
nvgFontSize(s->vg, 48*2.5);
|
||||
if (s->is_ego_over_limit) {
|
||||
nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 255));
|
||||
@@ -581,7 +581,7 @@ static void ui_draw_vision_speedlimit(UIState *s) {
|
||||
snprintf(speedlim_str, sizeof(speedlim_str), "%d", speedlim_calc);
|
||||
nvgText(s->vg, viz_speedlim_x+viz_speedlim_w/2, viz_speedlim_y + (is_speedlim_valid ? 170 : 165), speedlim_str, NULL);
|
||||
} else {
|
||||
nvgFontFace(s->vg, "sans-semibold");
|
||||
nvgFontFaceId(s->vg, s->font_sans_semibold);
|
||||
nvgFontSize(s->vg, 42*2.5);
|
||||
nvgText(s->vg, viz_speedlim_x+viz_speedlim_w/2, viz_speedlim_y + (is_speedlim_valid ? 170 : 165), "N/A", NULL);
|
||||
}
|
||||
@@ -606,12 +606,12 @@ static void ui_draw_vision_speed(UIState *s) {
|
||||
} else {
|
||||
snprintf(speed_str, sizeof(speed_str), "%d", (int)(speed * 2.2369363 + 0.5));
|
||||
}
|
||||
nvgFontFace(s->vg, "sans-bold");
|
||||
nvgFontFaceId(s->vg, s->font_sans_bold);
|
||||
nvgFontSize(s->vg, 96*2.5);
|
||||
nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 255));
|
||||
nvgText(s->vg, viz_speed_x+viz_speed_w/2, 240, speed_str, NULL);
|
||||
|
||||
nvgFontFace(s->vg, "sans-regular");
|
||||
nvgFontFaceId(s->vg, s->font_sans_regular);
|
||||
nvgFontSize(s->vg, 36*2.5);
|
||||
nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 200));
|
||||
|
||||
@@ -798,23 +798,23 @@ void ui_draw_vision_alert(UIState *s, int va_size, int va_color,
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BASELINE);
|
||||
|
||||
if (va_size == ALERTSIZE_SMALL) {
|
||||
nvgFontFace(s->vg, "sans-semibold");
|
||||
nvgFontFaceId(s->vg, s->font_sans_semibold);
|
||||
nvgFontSize(s->vg, 40*2.5);
|
||||
nvgText(s->vg, alr_x+alr_w/2, alr_y+alr_h/2+15, va_text1, NULL);
|
||||
} else if (va_size== ALERTSIZE_MID) {
|
||||
nvgFontFace(s->vg, "sans-bold");
|
||||
nvgFontFaceId(s->vg, s->font_sans_bold);
|
||||
nvgFontSize(s->vg, 48*2.5);
|
||||
nvgText(s->vg, alr_x+alr_w/2, alr_y+alr_h/2-45, va_text1, NULL);
|
||||
nvgFontFace(s->vg, "sans-regular");
|
||||
nvgFontFaceId(s->vg, s->font_sans_regular);
|
||||
nvgFontSize(s->vg, 36*2.5);
|
||||
nvgText(s->vg, alr_x+alr_w/2, alr_y+alr_h/2+75, va_text2, NULL);
|
||||
} else if (va_size== ALERTSIZE_FULL) {
|
||||
nvgFontSize(s->vg, (longAlert1?72:96)*2.5);
|
||||
nvgFontFace(s->vg, "sans-bold");
|
||||
nvgFontFaceId(s->vg, s->font_sans_bold);
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE);
|
||||
nvgTextBox(s->vg, alr_x, alr_y+(longAlert1?360:420), alr_w-60, va_text1, NULL);
|
||||
nvgFontSize(s->vg, 48*2.5);
|
||||
nvgFontFace(s->vg, "sans-regular");
|
||||
nvgFontFaceId(s->vg, s->font_sans_regular);
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_BOTTOM);
|
||||
nvgTextBox(s->vg, alr_x, alr_h-(longAlert1?300:360), alr_w-60, va_text2, NULL);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ static void ui_draw_sidebar_network_type(UIState *s, bool hasSidebar) {
|
||||
|
||||
nvgFillColor(s->vg, COLOR_WHITE);
|
||||
nvgFontSize(s->vg, 48);
|
||||
nvgFontFace(s->vg, "sans-regular");
|
||||
nvgFontFaceId(s->vg, s->font_sans_regular);
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE);
|
||||
nvgTextBox(s->vg, network_x, network_y, network_w, network_type_str, NULL);
|
||||
}
|
||||
@@ -124,19 +124,19 @@ static void ui_draw_sidebar_metric(UIState *s, const char* label_str, const char
|
||||
if (!message_str) {
|
||||
nvgFillColor(s->vg, COLOR_WHITE);
|
||||
nvgFontSize(s->vg, 78);
|
||||
nvgFontFace(s->vg, "sans-bold");
|
||||
nvgFontFaceId(s->vg, s->font_sans_bold);
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE);
|
||||
nvgTextBox(s->vg, metric_x + 50, metric_y + 50, metric_w - 60, value_str, NULL);
|
||||
|
||||
nvgFillColor(s->vg, COLOR_WHITE);
|
||||
nvgFontSize(s->vg, 48);
|
||||
nvgFontFace(s->vg, "sans-regular");
|
||||
nvgFontFaceId(s->vg, s->font_sans_regular);
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE);
|
||||
nvgTextBox(s->vg, metric_x + 50, metric_y + 50 + 66, metric_w - 60, label_str, NULL);
|
||||
} else {
|
||||
nvgFillColor(s->vg, COLOR_WHITE);
|
||||
nvgFontSize(s->vg, 48);
|
||||
nvgFontFace(s->vg, "sans-bold");
|
||||
nvgFontFaceId(s->vg, s->font_sans_bold);
|
||||
nvgTextAlign(s->vg, NVG_ALIGN_CENTER | NVG_ALIGN_MIDDLE);
|
||||
nvgTextBox(s->vg, metric_x + 35, metric_y + (strchr(message_str, '\n') ? 40 : 50), metric_w - 50, message_str, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user