Skip to content

Commit 188dce7

Browse files
committed
set sample text font to match project font
1 parent e625975 commit 188dce7

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/lynx/insights/lynx-insights-panel/lynx-insights-panel.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ $restoreActionColor: #5485e7;
104104

105105
.sample-text {
106106
white-space: nowrap;
107+
font-family: var(--project-font);
107108
}
108109
}
109110

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/lynx/insights/lynx-insights-panel/lynx-insights-panel.component.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { BehaviorSubject, of } from 'rxjs';
2424
import { anything, deepEqual, instance, mock, verify, when } from 'ts-mockito';
2525
import { ActivatedBookChapterService, RouteBookChapter } from 'xforge-common/activated-book-chapter.service';
2626
import { ActivatedProjectService } from 'xforge-common/activated-project.service';
27+
import { FontService } from 'xforge-common/font.service';
2728
import { I18nService } from 'xforge-common/i18n.service';
2829
import { IncludesPipe } from 'xforge-common/includes.pipe';
2930
import { configureTestingModule, getTestTranslocoModule } from 'xforge-common/test-utils';
@@ -43,6 +44,7 @@ const mockRouter = mock<Router>();
4344
const mockI18nService = mock<I18nService>();
4445
const mockEditorSegmentService = mock<EditorSegmentService>();
4546
const mockTextDoc = mock<TextDoc>();
47+
const mockFontService = mock(FontService);
4648

4749
const OPTIMIZATION_THRESHOLD = 50;
4850

@@ -132,6 +134,7 @@ describe('LynxInsightsPanelComponent', () => {
132134
{ provide: Router, useMock: mockRouter },
133135
{ provide: I18nService, useMock: mockI18nService },
134136
{ provide: EditorSegmentService, useMock: mockEditorSegmentService },
137+
{ provide: FontService, useMock: mockFontService },
135138
{
136139
provide: EDITOR_INSIGHT_DEFAULTS,
137140
useValue: {

src/SIL.XForge.Scripture/ClientApp/src/app/translate/editor/lynx/insights/lynx-insights-panel/lynx-insights-panel.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NgClass } from '@angular/common';
2-
import { AfterViewInit, Component, DestroyRef, Inject, ViewChild } from '@angular/core';
2+
import { AfterViewInit, Component, DestroyRef, HostBinding, Inject, ViewChild } from '@angular/core';
33
import { MatButton } from '@angular/material/button';
44
import { MatRipple } from '@angular/material/core';
55
import { MatIcon } from '@angular/material/icon';
@@ -23,6 +23,7 @@ import { DeltaOperation } from 'rich-text';
2323
import { asapScheduler, combineLatest, debounceTime, map, tap } from 'rxjs';
2424
import { ActivatedBookChapterService, RouteBookChapter } from 'xforge-common/activated-book-chapter.service';
2525
import { ActivatedProjectService } from 'xforge-common/activated-project.service';
26+
import { FontService } from 'xforge-common/font.service';
2627
import { I18nService } from 'xforge-common/i18n.service';
2728
import { quietTakeUntilDestroyed } from 'xforge-common/util/rxjs-util';
2829
import { isWhitespace } from 'xforge-common/util/string-util';
@@ -90,6 +91,10 @@ interface LynxInsightWithText extends LynxInsight {
9091
})
9192
export class LynxInsightsPanelComponent implements AfterViewInit {
9293
@ViewChild(MatTree) tree?: MatTree<InsightPanelNode>;
94+
@HostBinding('style.--project-font')
95+
get projectFont(): string | null {
96+
return this.fontService.getFontFamilyFromProject(this.activatedProject.projectDoc);
97+
}
9398

9499
treeDataSource: InsightPanelNode[] = [];
95100

@@ -152,6 +157,7 @@ export class LynxInsightsPanelComponent implements AfterViewInit {
152157
private readonly activatedBookChapterService: ActivatedBookChapterService,
153158
private readonly editorSegmentService: EditorSegmentService,
154159
private readonly projectService: SFProjectService,
160+
private readonly fontService: FontService,
155161
private readonly router: Router,
156162
readonly i18n: I18nService,
157163
@Inject(EDITOR_INSIGHT_DEFAULTS) readonly lynxInsightConfig: LynxInsightConfig

0 commit comments

Comments
 (0)