-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathfont_path.cpp
More file actions
37 lines (28 loc) · 858 Bytes
/
Copy pathfont_path.cpp
File metadata and controls
37 lines (28 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* Copyright (C) 2026 Shitty team
* MIT licensed
* See the file LICENSE.MIT for the full license.
*/
#include "font_path.h"
#include "composer.h"
#include "font_face.h"
#include "font_resolver.h"
#include <std/mem/obj_pool.h>
using namespace stl;
namespace {
struct PathFontResolverImpl final: public FontResolver {
PathFontResolverImpl();
FontFace* resolve(const FontRequest& request) override;
};
}
PathFontResolverImpl::PathFontResolverImpl() {
}
FontFace* PathFontResolverImpl::resolve(const FontRequest& request) {
if (request.style != FontStyle::Regular || (!request.name.memChr('/') && !request.name.memChr('\\'))) {
return nullptr;
}
return openFontFile(request.name, 0);
}
FontResolver* createPathFontResolver(Composer& composer) {
return composer.pool->make<PathFontResolverImpl>();
}