Skip to content

Commit 0003d99

Browse files
committed
set sample text font to match project font
1 parent 6c0ebdf commit 0003d99

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, TestTranslocoModule } from 'xforge-common/test-utils';
@@ -44,6 +45,7 @@ const mockRouter = mock<Router>();
4445
const mockI18nService = mock<I18nService>();
4546
const mockEditorSegmentService = mock<EditorSegmentService>();
4647
const mockTextDoc = mock<TextDoc>();
48+
const mockFontService = mock(FontService);
4749

4850
const OPTIMIZATION_THRESHOLD = 50;
4951

@@ -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,4 +1,4 @@
1-
import { AfterViewInit, Component, DestroyRef, Inject, ViewChild } from '@angular/core';
1+
import { AfterViewInit, Component, DestroyRef, HostBinding, Inject, ViewChild } from '@angular/core';
22
import { MatTree } from '@angular/material/tree';
33
import { Router } from '@angular/router';
44
import { Canon, VerseRef } from '@sillsdev/scripture';
@@ -15,6 +15,7 @@ import { DeltaOperation } from 'rich-text';
1515
import { asapScheduler, combineLatest, debounceTime, map, tap } from 'rxjs';
1616
import { ActivatedBookChapterService, RouteBookChapter } from 'xforge-common/activated-book-chapter.service';
1717
import { ActivatedProjectService } from 'xforge-common/activated-project.service';
18+
import { FontService } from 'xforge-common/font.service';
1819
import { I18nService } from 'xforge-common/i18n.service';
1920
import { quietTakeUntilDestroyed } from 'xforge-common/util/rxjs-util';
2021
import { isWhitespace } from 'xforge-common/util/string-util';
@@ -67,6 +68,10 @@ interface LynxInsightWithText extends LynxInsight {
6768
})
6869
export class LynxInsightsPanelComponent implements AfterViewInit {
6970
@ViewChild(MatTree) tree?: MatTree<InsightPanelNode>;
71+
@HostBinding('style.--project-font')
72+
get projectFont(): string | null {
73+
return this.fontService.getFontFamilyFromProject(this.activatedProject.projectDoc);
74+
}
7075

7176
treeDataSource: InsightPanelNode[] = [];
7277

@@ -129,6 +134,7 @@ export class LynxInsightsPanelComponent implements AfterViewInit {
129134
private readonly activatedBookChapterService: ActivatedBookChapterService,
130135
private readonly editorSegmentService: EditorSegmentService,
131136
private readonly projectService: SFProjectService,
137+
private readonly fontService: FontService,
132138
private readonly router: Router,
133139
readonly i18n: I18nService,
134140
@Inject(EDITOR_INSIGHT_DEFAULTS) readonly lynxInsightConfig: LynxInsightConfig

0 commit comments

Comments
 (0)