id
int32 0
167k
| repo
stringlengths 5
54
| path
stringlengths 4
155
| func_name
stringlengths 1
118
| original_string
stringlengths 52
85.5k
| language
stringclasses 1
value | code
stringlengths 52
85.5k
| code_tokens
listlengths 21
1.41k
| docstring
stringlengths 6
2.61k
| docstring_tokens
listlengths 3
215
| sha
stringlengths 40
40
| url
stringlengths 85
252
|
---|---|---|---|---|---|---|---|---|---|---|---|
8,400 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
CopyConvolutionFilter2D
|
func CopyConvolutionFilter2D(target uint32, internalformat uint32, x int32, y int32, width int32, height int32) {
C.glowCopyConvolutionFilter2D(gpCopyConvolutionFilter2D, (C.GLenum)(target), (C.GLenum)(internalformat), (C.GLint)(x), (C.GLint)(y), (C.GLsizei)(width), (C.GLsizei)(height))
}
|
go
|
func CopyConvolutionFilter2D(target uint32, internalformat uint32, x int32, y int32, width int32, height int32) {
C.glowCopyConvolutionFilter2D(gpCopyConvolutionFilter2D, (C.GLenum)(target), (C.GLenum)(internalformat), (C.GLint)(x), (C.GLint)(y), (C.GLsizei)(width), (C.GLsizei)(height))
}
|
[
"func",
"CopyConvolutionFilter2D",
"(",
"target",
"uint32",
",",
"internalformat",
"uint32",
",",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
")",
"{",
"C",
".",
"glowCopyConvolutionFilter2D",
"(",
"gpCopyConvolutionFilter2D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"x",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"y",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
")",
"\n",
"}"
] |
// copy pixels into a two-dimensional convolution filter
|
[
"copy",
"pixels",
"into",
"a",
"two",
"-",
"dimensional",
"convolution",
"filter"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L20887-L20889
|
8,401 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
DebugMessageCallback
|
func DebugMessageCallback(callback DebugProc, userParam unsafe.Pointer) {
userDebugCallback = callback
C.glowDebugMessageCallback(gpDebugMessageCallback, (C.GLDEBUGPROC)(unsafe.Pointer(&callback)), userParam)
}
|
go
|
func DebugMessageCallback(callback DebugProc, userParam unsafe.Pointer) {
userDebugCallback = callback
C.glowDebugMessageCallback(gpDebugMessageCallback, (C.GLDEBUGPROC)(unsafe.Pointer(&callback)), userParam)
}
|
[
"func",
"DebugMessageCallback",
"(",
"callback",
"DebugProc",
",",
"userParam",
"unsafe",
".",
"Pointer",
")",
"{",
"userDebugCallback",
"=",
"callback",
"\n",
"C",
".",
"glowDebugMessageCallback",
"(",
"gpDebugMessageCallback",
",",
"(",
"C",
".",
"GLDEBUGPROC",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"callback",
")",
")",
",",
"userParam",
")",
"\n",
"}"
] |
// specify a callback to receive debugging messages from the GL
|
[
"specify",
"a",
"callback",
"to",
"receive",
"debugging",
"messages",
"from",
"the",
"GL"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L21131-L21134
|
8,402 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
DrawArraysInstanced
|
func DrawArraysInstanced(mode uint32, first int32, count int32, instancecount int32) {
C.glowDrawArraysInstanced(gpDrawArraysInstanced, (C.GLenum)(mode), (C.GLint)(first), (C.GLsizei)(count), (C.GLsizei)(instancecount))
}
|
go
|
func DrawArraysInstanced(mode uint32, first int32, count int32, instancecount int32) {
C.glowDrawArraysInstanced(gpDrawArraysInstanced, (C.GLenum)(mode), (C.GLint)(first), (C.GLsizei)(count), (C.GLsizei)(instancecount))
}
|
[
"func",
"DrawArraysInstanced",
"(",
"mode",
"uint32",
",",
"first",
"int32",
",",
"count",
"int32",
",",
"instancecount",
"int32",
")",
"{",
"C",
".",
"glowDrawArraysInstanced",
"(",
"gpDrawArraysInstanced",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"mode",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"first",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"instancecount",
")",
")",
"\n",
"}"
] |
// draw multiple instances of a range of elements
|
[
"draw",
"multiple",
"instances",
"of",
"a",
"range",
"of",
"elements"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L21456-L21458
|
8,403 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
DrawElementsInstanced
|
func DrawElementsInstanced(mode uint32, count int32, xtype uint32, indices unsafe.Pointer, instancecount int32) {
C.glowDrawElementsInstanced(gpDrawElementsInstanced, (C.GLenum)(mode), (C.GLsizei)(count), (C.GLenum)(xtype), indices, (C.GLsizei)(instancecount))
}
|
go
|
func DrawElementsInstanced(mode uint32, count int32, xtype uint32, indices unsafe.Pointer, instancecount int32) {
C.glowDrawElementsInstanced(gpDrawElementsInstanced, (C.GLenum)(mode), (C.GLsizei)(count), (C.GLenum)(xtype), indices, (C.GLsizei)(instancecount))
}
|
[
"func",
"DrawElementsInstanced",
"(",
"mode",
"uint32",
",",
"count",
"int32",
",",
"xtype",
"uint32",
",",
"indices",
"unsafe",
".",
"Pointer",
",",
"instancecount",
"int32",
")",
"{",
"C",
".",
"glowDrawElementsInstanced",
"(",
"gpDrawElementsInstanced",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"mode",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"indices",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"instancecount",
")",
")",
"\n",
"}"
] |
// draw multiple instances of a set of elements
|
[
"draw",
"multiple",
"instances",
"of",
"a",
"set",
"of",
"elements"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L21521-L21523
|
8,404 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
FramebufferTexture
|
func FramebufferTexture(target uint32, attachment uint32, texture uint32, level int32) {
C.glowFramebufferTexture(gpFramebufferTexture, (C.GLenum)(target), (C.GLenum)(attachment), (C.GLuint)(texture), (C.GLint)(level))
}
|
go
|
func FramebufferTexture(target uint32, attachment uint32, texture uint32, level int32) {
C.glowFramebufferTexture(gpFramebufferTexture, (C.GLenum)(target), (C.GLenum)(attachment), (C.GLuint)(texture), (C.GLint)(level))
}
|
[
"func",
"FramebufferTexture",
"(",
"target",
"uint32",
",",
"attachment",
"uint32",
",",
"texture",
"uint32",
",",
"level",
"int32",
")",
"{",
"C",
".",
"glowFramebufferTexture",
"(",
"gpFramebufferTexture",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"attachment",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
")",
"\n",
"}"
] |
// attach a level of a texture object as a logical buffer of a framebuffer object
|
[
"attach",
"a",
"level",
"of",
"a",
"texture",
"object",
"as",
"a",
"logical",
"buffer",
"of",
"a",
"framebuffer",
"object"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L22020-L22022
|
8,405 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
GetBufferParameteri64v
|
func GetBufferParameteri64v(target uint32, pname uint32, params *int64) {
C.glowGetBufferParameteri64v(gpGetBufferParameteri64v, (C.GLenum)(target), (C.GLenum)(pname), (*C.GLint64)(unsafe.Pointer(params)))
}
|
go
|
func GetBufferParameteri64v(target uint32, pname uint32, params *int64) {
C.glowGetBufferParameteri64v(gpGetBufferParameteri64v, (C.GLenum)(target), (C.GLenum)(pname), (*C.GLint64)(unsafe.Pointer(params)))
}
|
[
"func",
"GetBufferParameteri64v",
"(",
"target",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int64",
")",
"{",
"C",
".",
"glowGetBufferParameteri64v",
"(",
"gpGetBufferParameteri64v",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"pname",
")",
",",
"(",
"*",
"C",
".",
"GLint64",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
] |
// return parameters of a buffer object
|
[
"return",
"parameters",
"of",
"a",
"buffer",
"object"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L22321-L22323
|
8,406 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
GetColorTable
|
func GetColorTable(target uint32, format uint32, xtype uint32, table unsafe.Pointer) {
C.glowGetColorTable(gpGetColorTable, (C.GLenum)(target), (C.GLenum)(format), (C.GLenum)(xtype), table)
}
|
go
|
func GetColorTable(target uint32, format uint32, xtype uint32, table unsafe.Pointer) {
C.glowGetColorTable(gpGetColorTable, (C.GLenum)(target), (C.GLenum)(format), (C.GLenum)(xtype), table)
}
|
[
"func",
"GetColorTable",
"(",
"target",
"uint32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"table",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowGetColorTable",
"(",
"gpGetColorTable",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"table",
")",
"\n",
"}"
] |
// retrieve contents of a color lookup table
|
[
"retrieve",
"contents",
"of",
"a",
"color",
"lookup",
"table"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L22364-L22366
|
8,407 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
GetConvolutionFilter
|
func GetConvolutionFilter(target uint32, format uint32, xtype uint32, image unsafe.Pointer) {
C.glowGetConvolutionFilter(gpGetConvolutionFilter, (C.GLenum)(target), (C.GLenum)(format), (C.GLenum)(xtype), image)
}
|
go
|
func GetConvolutionFilter(target uint32, format uint32, xtype uint32, image unsafe.Pointer) {
C.glowGetConvolutionFilter(gpGetConvolutionFilter, (C.GLenum)(target), (C.GLenum)(format), (C.GLenum)(xtype), image)
}
|
[
"func",
"GetConvolutionFilter",
"(",
"target",
"uint32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"image",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowGetConvolutionFilter",
"(",
"gpGetConvolutionFilter",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"image",
")",
"\n",
"}"
] |
// get current 1D or 2D convolution filter kernel
|
[
"get",
"current",
"1D",
"or",
"2D",
"convolution",
"filter",
"kernel"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L22436-L22438
|
8,408 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
GetFragDataLocation
|
func GetFragDataLocation(program uint32, name *uint8) int32 {
ret := C.glowGetFragDataLocation(gpGetFragDataLocation, (C.GLuint)(program), (*C.GLchar)(unsafe.Pointer(name)))
return (int32)(ret)
}
|
go
|
func GetFragDataLocation(program uint32, name *uint8) int32 {
ret := C.glowGetFragDataLocation(gpGetFragDataLocation, (C.GLuint)(program), (*C.GLchar)(unsafe.Pointer(name)))
return (int32)(ret)
}
|
[
"func",
"GetFragDataLocation",
"(",
"program",
"uint32",
",",
"name",
"*",
"uint8",
")",
"int32",
"{",
"ret",
":=",
"C",
".",
"glowGetFragDataLocation",
"(",
"gpGetFragDataLocation",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"return",
"(",
"int32",
")",
"(",
"ret",
")",
"\n",
"}"
] |
// query the bindings of color numbers to user-defined varying out variables
|
[
"query",
"the",
"bindings",
"of",
"color",
"numbers",
"to",
"user",
"-",
"defined",
"varying",
"out",
"variables"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L22537-L22540
|
8,409 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
GetHistogram
|
func GetHistogram(target uint32, reset bool, format uint32, xtype uint32, values unsafe.Pointer) {
C.glowGetHistogram(gpGetHistogram, (C.GLenum)(target), (C.GLboolean)(boolToInt(reset)), (C.GLenum)(format), (C.GLenum)(xtype), values)
}
|
go
|
func GetHistogram(target uint32, reset bool, format uint32, xtype uint32, values unsafe.Pointer) {
C.glowGetHistogram(gpGetHistogram, (C.GLenum)(target), (C.GLboolean)(boolToInt(reset)), (C.GLenum)(format), (C.GLenum)(xtype), values)
}
|
[
"func",
"GetHistogram",
"(",
"target",
"uint32",
",",
"reset",
"bool",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"values",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowGetHistogram",
"(",
"gpGetHistogram",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"reset",
")",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"values",
")",
"\n",
"}"
] |
// get histogram table
|
[
"get",
"histogram",
"table"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L22596-L22598
|
8,410 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
GetMinmax
|
func GetMinmax(target uint32, reset bool, format uint32, xtype uint32, values unsafe.Pointer) {
C.glowGetMinmax(gpGetMinmax, (C.GLenum)(target), (C.GLboolean)(boolToInt(reset)), (C.GLenum)(format), (C.GLenum)(xtype), values)
}
|
go
|
func GetMinmax(target uint32, reset bool, format uint32, xtype uint32, values unsafe.Pointer) {
C.glowGetMinmax(gpGetMinmax, (C.GLenum)(target), (C.GLboolean)(boolToInt(reset)), (C.GLenum)(format), (C.GLenum)(xtype), values)
}
|
[
"func",
"GetMinmax",
"(",
"target",
"uint32",
",",
"reset",
"bool",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"values",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowGetMinmax",
"(",
"gpGetMinmax",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"reset",
")",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"values",
")",
"\n",
"}"
] |
// get minimum and maximum pixel values
|
[
"get",
"minimum",
"and",
"maximum",
"pixel",
"values"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L22750-L22752
|
8,411 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
GetSeparableFilter
|
func GetSeparableFilter(target uint32, format uint32, xtype uint32, row unsafe.Pointer, column unsafe.Pointer, span unsafe.Pointer) {
C.glowGetSeparableFilter(gpGetSeparableFilter, (C.GLenum)(target), (C.GLenum)(format), (C.GLenum)(xtype), row, column, span)
}
|
go
|
func GetSeparableFilter(target uint32, format uint32, xtype uint32, row unsafe.Pointer, column unsafe.Pointer, span unsafe.Pointer) {
C.glowGetSeparableFilter(gpGetSeparableFilter, (C.GLenum)(target), (C.GLenum)(format), (C.GLenum)(xtype), row, column, span)
}
|
[
"func",
"GetSeparableFilter",
"(",
"target",
"uint32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"row",
"unsafe",
".",
"Pointer",
",",
"column",
"unsafe",
".",
"Pointer",
",",
"span",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowGetSeparableFilter",
"(",
"gpGetSeparableFilter",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"row",
",",
"column",
",",
"span",
")",
"\n",
"}"
] |
// get separable convolution filter kernel images
|
[
"get",
"separable",
"convolution",
"filter",
"kernel",
"images"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L23245-L23247
|
8,412 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
GetTransformFeedbackVarying
|
func GetTransformFeedbackVarying(program uint32, index uint32, bufSize int32, length *int32, size *int32, xtype *uint32, name *uint8) {
C.glowGetTransformFeedbackVarying(gpGetTransformFeedbackVarying, (C.GLuint)(program), (C.GLuint)(index), (C.GLsizei)(bufSize), (*C.GLsizei)(unsafe.Pointer(length)), (*C.GLsizei)(unsafe.Pointer(size)), (*C.GLenum)(unsafe.Pointer(xtype)), (*C.GLchar)(unsafe.Pointer(name)))
}
|
go
|
func GetTransformFeedbackVarying(program uint32, index uint32, bufSize int32, length *int32, size *int32, xtype *uint32, name *uint8) {
C.glowGetTransformFeedbackVarying(gpGetTransformFeedbackVarying, (C.GLuint)(program), (C.GLuint)(index), (C.GLsizei)(bufSize), (*C.GLsizei)(unsafe.Pointer(length)), (*C.GLsizei)(unsafe.Pointer(size)), (*C.GLenum)(unsafe.Pointer(xtype)), (*C.GLchar)(unsafe.Pointer(name)))
}
|
[
"func",
"GetTransformFeedbackVarying",
"(",
"program",
"uint32",
",",
"index",
"uint32",
",",
"bufSize",
"int32",
",",
"length",
"*",
"int32",
",",
"size",
"*",
"int32",
",",
"xtype",
"*",
"uint32",
",",
"name",
"*",
"uint8",
")",
"{",
"C",
".",
"glowGetTransformFeedbackVarying",
"(",
"gpGetTransformFeedbackVarying",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"index",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"bufSize",
")",
",",
"(",
"*",
"C",
".",
"GLsizei",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"length",
")",
")",
",",
"(",
"*",
"C",
".",
"GLsizei",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"size",
")",
")",
",",
"(",
"*",
"C",
".",
"GLenum",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"xtype",
")",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"}"
] |
// retrieve information about varying variables selected for transform feedback
|
[
"retrieve",
"information",
"about",
"varying",
"variables",
"selected",
"for",
"transform",
"feedback"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L23446-L23448
|
8,413 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
Histogram
|
func Histogram(target uint32, width int32, internalformat uint32, sink bool) {
C.glowHistogram(gpHistogram, (C.GLenum)(target), (C.GLsizei)(width), (C.GLenum)(internalformat), (C.GLboolean)(boolToInt(sink)))
}
|
go
|
func Histogram(target uint32, width int32, internalformat uint32, sink bool) {
C.glowHistogram(gpHistogram, (C.GLenum)(target), (C.GLsizei)(width), (C.GLenum)(internalformat), (C.GLboolean)(boolToInt(sink)))
}
|
[
"func",
"Histogram",
"(",
"target",
"uint32",
",",
"width",
"int32",
",",
"internalformat",
"uint32",
",",
"sink",
"bool",
")",
"{",
"C",
".",
"glowHistogram",
"(",
"gpHistogram",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"sink",
")",
")",
")",
"\n",
"}"
] |
// define histogram table
|
[
"define",
"histogram",
"table"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L23811-L23813
|
8,414 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
Minmax
|
func Minmax(target uint32, internalformat uint32, sink bool) {
C.glowMinmax(gpMinmax, (C.GLenum)(target), (C.GLenum)(internalformat), (C.GLboolean)(boolToInt(sink)))
}
|
go
|
func Minmax(target uint32, internalformat uint32, sink bool) {
C.glowMinmax(gpMinmax, (C.GLenum)(target), (C.GLenum)(internalformat), (C.GLboolean)(boolToInt(sink)))
}
|
[
"func",
"Minmax",
"(",
"target",
"uint32",
",",
"internalformat",
"uint32",
",",
"sink",
"bool",
")",
"{",
"C",
".",
"glowMinmax",
"(",
"gpMinmax",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"sink",
")",
")",
")",
"\n",
"}"
] |
// define minmax table
|
[
"define",
"minmax",
"table"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L24612-L24614
|
8,415 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
SeparableFilter2D
|
func SeparableFilter2D(target uint32, internalformat uint32, width int32, height int32, format uint32, xtype uint32, row unsafe.Pointer, column unsafe.Pointer) {
C.glowSeparableFilter2D(gpSeparableFilter2D, (C.GLenum)(target), (C.GLenum)(internalformat), (C.GLsizei)(width), (C.GLsizei)(height), (C.GLenum)(format), (C.GLenum)(xtype), row, column)
}
|
go
|
func SeparableFilter2D(target uint32, internalformat uint32, width int32, height int32, format uint32, xtype uint32, row unsafe.Pointer, column unsafe.Pointer) {
C.glowSeparableFilter2D(gpSeparableFilter2D, (C.GLenum)(target), (C.GLenum)(internalformat), (C.GLsizei)(width), (C.GLsizei)(height), (C.GLenum)(format), (C.GLenum)(xtype), row, column)
}
|
[
"func",
"SeparableFilter2D",
"(",
"target",
"uint32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"row",
"unsafe",
".",
"Pointer",
",",
"column",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowSeparableFilter2D",
"(",
"gpSeparableFilter2D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"row",
",",
"column",
")",
"\n",
"}"
] |
// define a separable two-dimensional convolution filter
|
[
"define",
"a",
"separable",
"two",
"-",
"dimensional",
"convolution",
"filter"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L26913-L26915
|
8,416 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
TexBuffer
|
func TexBuffer(target uint32, internalformat uint32, buffer uint32) {
C.glowTexBuffer(gpTexBuffer, (C.GLenum)(target), (C.GLenum)(internalformat), (C.GLuint)(buffer))
}
|
go
|
func TexBuffer(target uint32, internalformat uint32, buffer uint32) {
C.glowTexBuffer(gpTexBuffer, (C.GLenum)(target), (C.GLenum)(internalformat), (C.GLuint)(buffer))
}
|
[
"func",
"TexBuffer",
"(",
"target",
"uint32",
",",
"internalformat",
"uint32",
",",
"buffer",
"uint32",
")",
"{",
"C",
".",
"glowTexBuffer",
"(",
"gpTexBuffer",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"buffer",
")",
")",
"\n",
"}"
] |
// attach a buffer object's data store to a buffer texture object
|
[
"attach",
"a",
"buffer",
"object",
"s",
"data",
"store",
"to",
"a",
"buffer",
"texture",
"object"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L27142-L27144
|
8,417 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
TransformFeedbackVaryings
|
func TransformFeedbackVaryings(program uint32, count int32, varyings **uint8, bufferMode uint32) {
C.glowTransformFeedbackVaryings(gpTransformFeedbackVaryings, (C.GLuint)(program), (C.GLsizei)(count), (**C.GLchar)(unsafe.Pointer(varyings)), (C.GLenum)(bufferMode))
}
|
go
|
func TransformFeedbackVaryings(program uint32, count int32, varyings **uint8, bufferMode uint32) {
C.glowTransformFeedbackVaryings(gpTransformFeedbackVaryings, (C.GLuint)(program), (C.GLsizei)(count), (**C.GLchar)(unsafe.Pointer(varyings)), (C.GLenum)(bufferMode))
}
|
[
"func",
"TransformFeedbackVaryings",
"(",
"program",
"uint32",
",",
"count",
"int32",
",",
"varyings",
"*",
"*",
"uint8",
",",
"bufferMode",
"uint32",
")",
"{",
"C",
".",
"glowTransformFeedbackVaryings",
"(",
"gpTransformFeedbackVaryings",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"varyings",
")",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"bufferMode",
")",
")",
"\n",
"}"
] |
// specify values to record in transform feedback buffers
|
[
"specify",
"values",
"to",
"record",
"in",
"transform",
"feedback",
"buffers"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L27811-L27813
|
8,418 |
go-gl/gl
|
v4.3-compatibility/gl/package.go
|
VertexAttribDivisor
|
func VertexAttribDivisor(index uint32, divisor uint32) {
C.glowVertexAttribDivisor(gpVertexAttribDivisor, (C.GLuint)(index), (C.GLuint)(divisor))
}
|
go
|
func VertexAttribDivisor(index uint32, divisor uint32) {
C.glowVertexAttribDivisor(gpVertexAttribDivisor, (C.GLuint)(index), (C.GLuint)(divisor))
}
|
[
"func",
"VertexAttribDivisor",
"(",
"index",
"uint32",
",",
"divisor",
"uint32",
")",
"{",
"C",
".",
"glowVertexAttribDivisor",
"(",
"gpVertexAttribDivisor",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"index",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"divisor",
")",
")",
"\n",
"}"
] |
// modify the rate at which generic vertex attributes advance during instanced rendering
|
[
"modify",
"the",
"rate",
"at",
"which",
"generic",
"vertex",
"attributes",
"advance",
"during",
"instanced",
"rendering"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/v4.3-compatibility/gl/package.go#L28938-L28940
|
8,419 |
go-gl/gl
|
all-core/gl/package.go
|
GetnCompressedTexImage
|
func GetnCompressedTexImage(target uint32, lod int32, bufSize int32, pixels unsafe.Pointer) {
C.glowGetnCompressedTexImage(gpGetnCompressedTexImage, (C.GLenum)(target), (C.GLint)(lod), (C.GLsizei)(bufSize), pixels)
}
|
go
|
func GetnCompressedTexImage(target uint32, lod int32, bufSize int32, pixels unsafe.Pointer) {
C.glowGetnCompressedTexImage(gpGetnCompressedTexImage, (C.GLenum)(target), (C.GLint)(lod), (C.GLsizei)(bufSize), pixels)
}
|
[
"func",
"GetnCompressedTexImage",
"(",
"target",
"uint32",
",",
"lod",
"int32",
",",
"bufSize",
"int32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowGetnCompressedTexImage",
"(",
"gpGetnCompressedTexImage",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"lod",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"bufSize",
")",
",",
"pixels",
")",
"\n",
"}"
] |
// return a compressed texture image
|
[
"return",
"a",
"compressed",
"texture",
"image"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/all-core/gl/package.go#L13112-L13114
|
8,420 |
go-gl/gl
|
all-core/gl/package.go
|
GetnTexImage
|
func GetnTexImage(target uint32, level int32, format uint32, xtype uint32, bufSize int32, pixels unsafe.Pointer) {
C.glowGetnTexImage(gpGetnTexImage, (C.GLenum)(target), (C.GLint)(level), (C.GLenum)(format), (C.GLenum)(xtype), (C.GLsizei)(bufSize), pixels)
}
|
go
|
func GetnTexImage(target uint32, level int32, format uint32, xtype uint32, bufSize int32, pixels unsafe.Pointer) {
C.glowGetnTexImage(gpGetnTexImage, (C.GLenum)(target), (C.GLint)(level), (C.GLenum)(format), (C.GLenum)(xtype), (C.GLsizei)(bufSize), pixels)
}
|
[
"func",
"GetnTexImage",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"bufSize",
"int32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowGetnTexImage",
"(",
"gpGetnTexImage",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"bufSize",
")",
",",
"pixels",
")",
"\n",
"}"
] |
// return a texture image
|
[
"return",
"a",
"texture",
"image"
] |
bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587
|
https://github.com/go-gl/gl/blob/bf2b1f2f34d7f6a60a99a830f65dcd6afb0c6587/all-core/gl/package.go#L13120-L13122
|
8,421 |
gavv/httpexpect
|
websocket_dialer.go
|
NewWebsocketDialer
|
func NewWebsocketDialer(handler http.Handler) *websocket.Dialer {
return &websocket.Dialer{
NetDial: func(network, addr string) (net.Conn, error) {
hc := newHandlerConn()
hc.runHandler(handler)
return hc, nil
},
}
}
|
go
|
func NewWebsocketDialer(handler http.Handler) *websocket.Dialer {
return &websocket.Dialer{
NetDial: func(network, addr string) (net.Conn, error) {
hc := newHandlerConn()
hc.runHandler(handler)
return hc, nil
},
}
}
|
[
"func",
"NewWebsocketDialer",
"(",
"handler",
"http",
".",
"Handler",
")",
"*",
"websocket",
".",
"Dialer",
"{",
"return",
"&",
"websocket",
".",
"Dialer",
"{",
"NetDial",
":",
"func",
"(",
"network",
",",
"addr",
"string",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"hc",
":=",
"newHandlerConn",
"(",
")",
"\n",
"hc",
".",
"runHandler",
"(",
"handler",
")",
"\n",
"return",
"hc",
",",
"nil",
"\n",
"}",
",",
"}",
"\n",
"}"
] |
// NewWebsocketDialer produces new websocket.Dialer which dials to bound
// http.Handler without creating a real net.Conn.
|
[
"NewWebsocketDialer",
"produces",
"new",
"websocket",
".",
"Dialer",
"which",
"dials",
"to",
"bound",
"http",
".",
"Handler",
"without",
"creating",
"a",
"real",
"net",
".",
"Conn",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/websocket_dialer.go#L16-L24
|
8,422 |
gavv/httpexpect
|
websocket_dialer.go
|
NewFastWebsocketDialer
|
func NewFastWebsocketDialer(handler fasthttp.RequestHandler) *websocket.Dialer {
return &websocket.Dialer{
NetDial: func(network, addr string) (net.Conn, error) {
hc := newHandlerConn()
hc.runFastHandler(handler)
return hc, nil
},
}
}
|
go
|
func NewFastWebsocketDialer(handler fasthttp.RequestHandler) *websocket.Dialer {
return &websocket.Dialer{
NetDial: func(network, addr string) (net.Conn, error) {
hc := newHandlerConn()
hc.runFastHandler(handler)
return hc, nil
},
}
}
|
[
"func",
"NewFastWebsocketDialer",
"(",
"handler",
"fasthttp",
".",
"RequestHandler",
")",
"*",
"websocket",
".",
"Dialer",
"{",
"return",
"&",
"websocket",
".",
"Dialer",
"{",
"NetDial",
":",
"func",
"(",
"network",
",",
"addr",
"string",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"hc",
":=",
"newHandlerConn",
"(",
")",
"\n",
"hc",
".",
"runFastHandler",
"(",
"handler",
")",
"\n",
"return",
"hc",
",",
"nil",
"\n",
"}",
",",
"}",
"\n",
"}"
] |
// NewFastWebsocketDialer produces new websocket.Dialer which dials to bound
// fasthttp.RequestHandler without creating a real net.Conn.
|
[
"NewFastWebsocketDialer",
"produces",
"new",
"websocket",
".",
"Dialer",
"which",
"dials",
"to",
"bound",
"fasthttp",
".",
"RequestHandler",
"without",
"creating",
"a",
"real",
"net",
".",
"Conn",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/websocket_dialer.go#L28-L36
|
8,423 |
gavv/httpexpect
|
websocket_dialer.go
|
Hijack
|
func (r *hijackRecorder) Hijack() (net.Conn, *bufio.ReadWriter, error) {
rw := bufio.NewReadWriter(bufio.NewReader(r.conn), bufio.NewWriter(r.conn))
return r.conn, rw, nil
}
|
go
|
func (r *hijackRecorder) Hijack() (net.Conn, *bufio.ReadWriter, error) {
rw := bufio.NewReadWriter(bufio.NewReader(r.conn), bufio.NewWriter(r.conn))
return r.conn, rw, nil
}
|
[
"func",
"(",
"r",
"*",
"hijackRecorder",
")",
"Hijack",
"(",
")",
"(",
"net",
".",
"Conn",
",",
"*",
"bufio",
".",
"ReadWriter",
",",
"error",
")",
"{",
"rw",
":=",
"bufio",
".",
"NewReadWriter",
"(",
"bufio",
".",
"NewReader",
"(",
"r",
".",
"conn",
")",
",",
"bufio",
".",
"NewWriter",
"(",
"r",
".",
"conn",
")",
")",
"\n",
"return",
"r",
".",
"conn",
",",
"rw",
",",
"nil",
"\n",
"}"
] |
// Hijack the connection for caller.
//
// Implements http.Hijacker interface.
|
[
"Hijack",
"the",
"connection",
"for",
"caller",
".",
"Implements",
"http",
".",
"Hijacker",
"interface",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/websocket_dialer.go#L100-L103
|
8,424 |
gavv/httpexpect
|
websocket_dialer.go
|
WriteHeader
|
func (r *hijackRecorder) WriteHeader(code int) {
resp := http.Response{StatusCode: code, Header: r.Header()}
_ = resp.Write(r.conn)
}
|
go
|
func (r *hijackRecorder) WriteHeader(code int) {
resp := http.Response{StatusCode: code, Header: r.Header()}
_ = resp.Write(r.conn)
}
|
[
"func",
"(",
"r",
"*",
"hijackRecorder",
")",
"WriteHeader",
"(",
"code",
"int",
")",
"{",
"resp",
":=",
"http",
".",
"Response",
"{",
"StatusCode",
":",
"code",
",",
"Header",
":",
"r",
".",
"Header",
"(",
")",
"}",
"\n",
"_",
"=",
"resp",
".",
"Write",
"(",
"r",
".",
"conn",
")",
"\n",
"}"
] |
// WriteHeader write HTTP header to the client and closes the connection
//
// Implements http.ResponseWriter interface.
|
[
"WriteHeader",
"write",
"HTTP",
"header",
"to",
"the",
"client",
"and",
"closes",
"the",
"connection",
"Implements",
"http",
".",
"ResponseWriter",
"interface",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/websocket_dialer.go#L108-L111
|
8,425 |
gavv/httpexpect
|
websocket_message.go
|
Raw
|
func (m *WebsocketMessage) Raw() (typ int, content []byte, closeCode int) {
return m.typ, m.content, m.closeCode
}
|
go
|
func (m *WebsocketMessage) Raw() (typ int, content []byte, closeCode int) {
return m.typ, m.content, m.closeCode
}
|
[
"func",
"(",
"m",
"*",
"WebsocketMessage",
")",
"Raw",
"(",
")",
"(",
"typ",
"int",
",",
"content",
"[",
"]",
"byte",
",",
"closeCode",
"int",
")",
"{",
"return",
"m",
".",
"typ",
",",
"m",
".",
"content",
",",
"m",
".",
"closeCode",
"\n",
"}"
] |
// Raw returns underlying type, content and close code of WebSocket message.
// Theses values are originally read from WebSocket connection.
|
[
"Raw",
"returns",
"underlying",
"type",
"content",
"and",
"close",
"code",
"of",
"WebSocket",
"message",
".",
"Theses",
"values",
"are",
"originally",
"read",
"from",
"WebSocket",
"connection",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/websocket_message.go#L47-L49
|
8,426 |
gavv/httpexpect
|
expect.go
|
NewRequest
|
func (DefaultRequestFactory) NewRequest(
method, urlStr string, body io.Reader) (*http.Request, error) {
return http.NewRequest(method, urlStr, body)
}
|
go
|
func (DefaultRequestFactory) NewRequest(
method, urlStr string, body io.Reader) (*http.Request, error) {
return http.NewRequest(method, urlStr, body)
}
|
[
"func",
"(",
"DefaultRequestFactory",
")",
"NewRequest",
"(",
"method",
",",
"urlStr",
"string",
",",
"body",
"io",
".",
"Reader",
")",
"(",
"*",
"http",
".",
"Request",
",",
"error",
")",
"{",
"return",
"http",
".",
"NewRequest",
"(",
"method",
",",
"urlStr",
",",
"body",
")",
"\n",
"}"
] |
// NewRequest implements RequestFactory.NewRequest.
|
[
"NewRequest",
"implements",
"RequestFactory",
".",
"NewRequest",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/expect.go#L227-L230
|
8,427 |
gavv/httpexpect
|
expect.go
|
Request
|
func (e *Expect) Request(method, path string, pathargs ...interface{}) *Request {
req := NewRequest(e.config, method, path, pathargs...)
for _, builder := range e.builders {
builder(req)
}
for _, matcher := range e.matchers {
req.WithMatcher(matcher)
}
return req
}
|
go
|
func (e *Expect) Request(method, path string, pathargs ...interface{}) *Request {
req := NewRequest(e.config, method, path, pathargs...)
for _, builder := range e.builders {
builder(req)
}
for _, matcher := range e.matchers {
req.WithMatcher(matcher)
}
return req
}
|
[
"func",
"(",
"e",
"*",
"Expect",
")",
"Request",
"(",
"method",
",",
"path",
"string",
",",
"pathargs",
"...",
"interface",
"{",
"}",
")",
"*",
"Request",
"{",
"req",
":=",
"NewRequest",
"(",
"e",
".",
"config",
",",
"method",
",",
"path",
",",
"pathargs",
"...",
")",
"\n\n",
"for",
"_",
",",
"builder",
":=",
"range",
"e",
".",
"builders",
"{",
"builder",
"(",
"req",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"matcher",
":=",
"range",
"e",
".",
"matchers",
"{",
"req",
".",
"WithMatcher",
"(",
"matcher",
")",
"\n",
"}",
"\n\n",
"return",
"req",
"\n",
"}"
] |
// Request returns a new Request object.
// Arguments a similar to NewRequest.
// After creating request, all builders attached to Expect object are invoked.
// See Builder.
|
[
"Request",
"returns",
"a",
"new",
"Request",
"object",
".",
"Arguments",
"a",
"similar",
"to",
"NewRequest",
".",
"After",
"creating",
"request",
"all",
"builders",
"attached",
"to",
"Expect",
"object",
"are",
"invoked",
".",
"See",
"Builder",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/expect.go#L386-L398
|
8,428 |
gavv/httpexpect
|
response.go
|
NoContent
|
func (r *Response) NoContent() *Response {
if r.chain.failed() {
return r
}
contentType := r.resp.Header.Get("Content-Type")
r.checkEqual("\"Content-Type\" header", "", contentType)
r.checkEqual("body", "", string(r.content))
return r
}
|
go
|
func (r *Response) NoContent() *Response {
if r.chain.failed() {
return r
}
contentType := r.resp.Header.Get("Content-Type")
r.checkEqual("\"Content-Type\" header", "", contentType)
r.checkEqual("body", "", string(r.content))
return r
}
|
[
"func",
"(",
"r",
"*",
"Response",
")",
"NoContent",
"(",
")",
"*",
"Response",
"{",
"if",
"r",
".",
"chain",
".",
"failed",
"(",
")",
"{",
"return",
"r",
"\n",
"}",
"\n\n",
"contentType",
":=",
"r",
".",
"resp",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n\n",
"r",
".",
"checkEqual",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"\"",
"\"",
",",
"contentType",
")",
"\n",
"r",
".",
"checkEqual",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"string",
"(",
"r",
".",
"content",
")",
")",
"\n\n",
"return",
"r",
"\n",
"}"
] |
// NoContent succeeds if response contains empty Content-Type header and
// empty body.
|
[
"NoContent",
"succeeds",
"if",
"response",
"contains",
"empty",
"Content",
"-",
"Type",
"header",
"and",
"empty",
"body",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/response.go#L321-L332
|
8,429 |
gavv/httpexpect
|
response.go
|
ContentType
|
func (r *Response) ContentType(mediaType string, charset ...string) *Response {
r.checkContentType(mediaType, charset...)
return r
}
|
go
|
func (r *Response) ContentType(mediaType string, charset ...string) *Response {
r.checkContentType(mediaType, charset...)
return r
}
|
[
"func",
"(",
"r",
"*",
"Response",
")",
"ContentType",
"(",
"mediaType",
"string",
",",
"charset",
"...",
"string",
")",
"*",
"Response",
"{",
"r",
".",
"checkContentType",
"(",
"mediaType",
",",
"charset",
"...",
")",
"\n",
"return",
"r",
"\n",
"}"
] |
// ContentType succeeds if response contains Content-Type header with given
// media type and charset.
//
// If charset is omitted, and mediaType is non-empty, Content-Type header
// should contain empty or utf-8 charset.
//
// If charset is omitted, and mediaType is also empty, Content-Type header
// should contain no charset.
|
[
"ContentType",
"succeeds",
"if",
"response",
"contains",
"Content",
"-",
"Type",
"header",
"with",
"given",
"media",
"type",
"and",
"charset",
".",
"If",
"charset",
"is",
"omitted",
"and",
"mediaType",
"is",
"non",
"-",
"empty",
"Content",
"-",
"Type",
"header",
"should",
"contain",
"empty",
"or",
"utf",
"-",
"8",
"charset",
".",
"If",
"charset",
"is",
"omitted",
"and",
"mediaType",
"is",
"also",
"empty",
"Content",
"-",
"Type",
"header",
"should",
"contain",
"no",
"charset",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/response.go#L342-L345
|
8,430 |
gavv/httpexpect
|
response.go
|
ContentEncoding
|
func (r *Response) ContentEncoding(encoding ...string) *Response {
if r.chain.failed() {
return r
}
r.checkEqual("\"Content-Encoding\" header", encoding, r.resp.Header["Content-Encoding"])
return r
}
|
go
|
func (r *Response) ContentEncoding(encoding ...string) *Response {
if r.chain.failed() {
return r
}
r.checkEqual("\"Content-Encoding\" header", encoding, r.resp.Header["Content-Encoding"])
return r
}
|
[
"func",
"(",
"r",
"*",
"Response",
")",
"ContentEncoding",
"(",
"encoding",
"...",
"string",
")",
"*",
"Response",
"{",
"if",
"r",
".",
"chain",
".",
"failed",
"(",
")",
"{",
"return",
"r",
"\n",
"}",
"\n",
"r",
".",
"checkEqual",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"encoding",
",",
"r",
".",
"resp",
".",
"Header",
"[",
"\"",
"\"",
"]",
")",
"\n",
"return",
"r",
"\n",
"}"
] |
// ContentEncoding succeeds if response has exactly given Content-Encoding list.
// Common values are empty, "gzip", "compress", "deflate", "identity" and "br".
|
[
"ContentEncoding",
"succeeds",
"if",
"response",
"has",
"exactly",
"given",
"Content",
"-",
"Encoding",
"list",
".",
"Common",
"values",
"are",
"empty",
"gzip",
"compress",
"deflate",
"identity",
"and",
"br",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/response.go#L349-L355
|
8,431 |
gavv/httpexpect
|
response.go
|
TransferEncoding
|
func (r *Response) TransferEncoding(encoding ...string) *Response {
if r.chain.failed() {
return r
}
r.checkEqual("\"Transfer-Encoding\" header", encoding, r.resp.TransferEncoding)
return r
}
|
go
|
func (r *Response) TransferEncoding(encoding ...string) *Response {
if r.chain.failed() {
return r
}
r.checkEqual("\"Transfer-Encoding\" header", encoding, r.resp.TransferEncoding)
return r
}
|
[
"func",
"(",
"r",
"*",
"Response",
")",
"TransferEncoding",
"(",
"encoding",
"...",
"string",
")",
"*",
"Response",
"{",
"if",
"r",
".",
"chain",
".",
"failed",
"(",
")",
"{",
"return",
"r",
"\n",
"}",
"\n",
"r",
".",
"checkEqual",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"encoding",
",",
"r",
".",
"resp",
".",
"TransferEncoding",
")",
"\n",
"return",
"r",
"\n",
"}"
] |
// TransferEncoding succeeds if response contains given Transfer-Encoding list.
// Common values are empty, "chunked" and "identity".
|
[
"TransferEncoding",
"succeeds",
"if",
"response",
"contains",
"given",
"Transfer",
"-",
"Encoding",
"list",
".",
"Common",
"values",
"are",
"empty",
"chunked",
"and",
"identity",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/response.go#L359-L365
|
8,432 |
gavv/httpexpect
|
websocket.go
|
NewWebsocket
|
func NewWebsocket(config Config, conn *websocket.Conn) *Websocket {
return makeWebsocket(config, makeChain(config.Reporter), conn)
}
|
go
|
func NewWebsocket(config Config, conn *websocket.Conn) *Websocket {
return makeWebsocket(config, makeChain(config.Reporter), conn)
}
|
[
"func",
"NewWebsocket",
"(",
"config",
"Config",
",",
"conn",
"*",
"websocket",
".",
"Conn",
")",
"*",
"Websocket",
"{",
"return",
"makeWebsocket",
"(",
"config",
",",
"makeChain",
"(",
"config",
".",
"Reporter",
")",
",",
"conn",
")",
"\n",
"}"
] |
// NewWebsocket returns a new Websocket given a Config with Reporter and
// Printers, and websocket.Conn to be inspected and handled.
|
[
"NewWebsocket",
"returns",
"a",
"new",
"Websocket",
"given",
"a",
"Config",
"with",
"Reporter",
"and",
"Printers",
"and",
"websocket",
".",
"Conn",
"to",
"be",
"inspected",
"and",
"handled",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/websocket.go#L27-L29
|
8,433 |
gavv/httpexpect
|
websocket.go
|
WithReadTimeout
|
func (c *Websocket) WithReadTimeout(timeout time.Duration) *Websocket {
c.readTimeout = timeout
return c
}
|
go
|
func (c *Websocket) WithReadTimeout(timeout time.Duration) *Websocket {
c.readTimeout = timeout
return c
}
|
[
"func",
"(",
"c",
"*",
"Websocket",
")",
"WithReadTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"Websocket",
"{",
"c",
".",
"readTimeout",
"=",
"timeout",
"\n",
"return",
"c",
"\n",
"}"
] |
// WithReadTimeout sets timeout duration for WebSocket connection reads.
//
// By default no timeout is used.
|
[
"WithReadTimeout",
"sets",
"timeout",
"duration",
"for",
"WebSocket",
"connection",
"reads",
".",
"By",
"default",
"no",
"timeout",
"is",
"used",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/websocket.go#L48-L51
|
8,434 |
gavv/httpexpect
|
websocket.go
|
WithWriteTimeout
|
func (c *Websocket) WithWriteTimeout(timeout time.Duration) *Websocket {
c.writeTimeout = timeout
return c
}
|
go
|
func (c *Websocket) WithWriteTimeout(timeout time.Duration) *Websocket {
c.writeTimeout = timeout
return c
}
|
[
"func",
"(",
"c",
"*",
"Websocket",
")",
"WithWriteTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"Websocket",
"{",
"c",
".",
"writeTimeout",
"=",
"timeout",
"\n",
"return",
"c",
"\n",
"}"
] |
// WithWriteTimeout sets timeout duration for WebSocket connection writes.
//
// By default no timeout is used.
|
[
"WithWriteTimeout",
"sets",
"timeout",
"duration",
"for",
"WebSocket",
"connection",
"writes",
".",
"By",
"default",
"no",
"timeout",
"is",
"used",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/websocket.go#L62-L65
|
8,435 |
gavv/httpexpect
|
websocket.go
|
Subprotocol
|
func (c *Websocket) Subprotocol() *String {
s := &String{chain: c.chain}
if c.conn != nil {
s.value = c.conn.Subprotocol()
}
return s
}
|
go
|
func (c *Websocket) Subprotocol() *String {
s := &String{chain: c.chain}
if c.conn != nil {
s.value = c.conn.Subprotocol()
}
return s
}
|
[
"func",
"(",
"c",
"*",
"Websocket",
")",
"Subprotocol",
"(",
")",
"*",
"String",
"{",
"s",
":=",
"&",
"String",
"{",
"chain",
":",
"c",
".",
"chain",
"}",
"\n",
"if",
"c",
".",
"conn",
"!=",
"nil",
"{",
"s",
".",
"value",
"=",
"c",
".",
"conn",
".",
"Subprotocol",
"(",
")",
"\n",
"}",
"\n",
"return",
"s",
"\n",
"}"
] |
// Subprotocol returns a new String object that may be used to inspect
// negotiated protocol for the connection.
|
[
"Subprotocol",
"returns",
"a",
"new",
"String",
"object",
"that",
"may",
"be",
"used",
"to",
"inspect",
"negotiated",
"protocol",
"for",
"the",
"connection",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/websocket.go#L77-L83
|
8,436 |
gavv/httpexpect
|
printer.go
|
Response
|
func (p DebugPrinter) Response(resp *http.Response, duration time.Duration) {
if resp == nil {
return
}
dump, err := httputil.DumpResponse(resp, p.body)
if err != nil {
panic(err)
}
text := strings.Replace(string(dump), "\r\n", "\n", -1)
lines := strings.SplitN(text, "\n", 2)
p.logger.Logf("%s %s\n%s", lines[0], duration, lines[1])
}
|
go
|
func (p DebugPrinter) Response(resp *http.Response, duration time.Duration) {
if resp == nil {
return
}
dump, err := httputil.DumpResponse(resp, p.body)
if err != nil {
panic(err)
}
text := strings.Replace(string(dump), "\r\n", "\n", -1)
lines := strings.SplitN(text, "\n", 2)
p.logger.Logf("%s %s\n%s", lines[0], duration, lines[1])
}
|
[
"func",
"(",
"p",
"DebugPrinter",
")",
"Response",
"(",
"resp",
"*",
"http",
".",
"Response",
",",
"duration",
"time",
".",
"Duration",
")",
"{",
"if",
"resp",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"dump",
",",
"err",
":=",
"httputil",
".",
"DumpResponse",
"(",
"resp",
",",
"p",
".",
"body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"text",
":=",
"strings",
".",
"Replace",
"(",
"string",
"(",
"dump",
")",
",",
"\"",
"\\r",
"\\n",
"\"",
",",
"\"",
"\\n",
"\"",
",",
"-",
"1",
")",
"\n",
"lines",
":=",
"strings",
".",
"SplitN",
"(",
"text",
",",
"\"",
"\\n",
"\"",
",",
"2",
")",
"\n\n",
"p",
".",
"logger",
".",
"Logf",
"(",
"\"",
"\\n",
"\"",
",",
"lines",
"[",
"0",
"]",
",",
"duration",
",",
"lines",
"[",
"1",
"]",
")",
"\n",
"}"
] |
// Response implements Printer.Response.
|
[
"Response",
"implements",
"Printer",
".",
"Response",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/printer.go#L89-L103
|
8,437 |
gavv/httpexpect
|
printer.go
|
WebsocketRead
|
func (p DebugPrinter) WebsocketRead(typ int, content []byte, closeCode int) {
b := &bytes.Buffer{}
fmt.Fprintf(b, "<- Received: %s", wsMessageTypeName(typ))
if typ == websocket.CloseMessage {
fmt.Fprintf(b, " (%d)", closeCode)
}
fmt.Fprint(b, "\n")
if len(content) > 0 {
if typ == websocket.BinaryMessage {
fmt.Fprintf(b, "%v\n", content)
} else {
fmt.Fprintf(b, "%s\n", content)
}
}
fmt.Fprintf(b, "\n")
p.logger.Logf(b.String())
}
|
go
|
func (p DebugPrinter) WebsocketRead(typ int, content []byte, closeCode int) {
b := &bytes.Buffer{}
fmt.Fprintf(b, "<- Received: %s", wsMessageTypeName(typ))
if typ == websocket.CloseMessage {
fmt.Fprintf(b, " (%d)", closeCode)
}
fmt.Fprint(b, "\n")
if len(content) > 0 {
if typ == websocket.BinaryMessage {
fmt.Fprintf(b, "%v\n", content)
} else {
fmt.Fprintf(b, "%s\n", content)
}
}
fmt.Fprintf(b, "\n")
p.logger.Logf(b.String())
}
|
[
"func",
"(",
"p",
"DebugPrinter",
")",
"WebsocketRead",
"(",
"typ",
"int",
",",
"content",
"[",
"]",
"byte",
",",
"closeCode",
"int",
")",
"{",
"b",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"b",
",",
"\"",
"\"",
",",
"wsMessageTypeName",
"(",
"typ",
")",
")",
"\n",
"if",
"typ",
"==",
"websocket",
".",
"CloseMessage",
"{",
"fmt",
".",
"Fprintf",
"(",
"b",
",",
"\"",
"\"",
",",
"closeCode",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprint",
"(",
"b",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"if",
"len",
"(",
"content",
")",
">",
"0",
"{",
"if",
"typ",
"==",
"websocket",
".",
"BinaryMessage",
"{",
"fmt",
".",
"Fprintf",
"(",
"b",
",",
"\"",
"\\n",
"\"",
",",
"content",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprintf",
"(",
"b",
",",
"\"",
"\\n",
"\"",
",",
"content",
")",
"\n",
"}",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"b",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"p",
".",
"logger",
".",
"Logf",
"(",
"b",
".",
"String",
"(",
")",
")",
"\n",
"}"
] |
// WebsocketRead implements WebsocketPrinter.WebsocketRead.
|
[
"WebsocketRead",
"implements",
"WebsocketPrinter",
".",
"WebsocketRead",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/printer.go#L125-L141
|
8,438 |
gavv/httpexpect
|
duration.go
|
NotSet
|
func (d *Duration) NotSet() *Duration {
if d.value != nil {
d.chain.fail("expected duration is not set, but it is")
}
return d
}
|
go
|
func (d *Duration) NotSet() *Duration {
if d.value != nil {
d.chain.fail("expected duration is not set, but it is")
}
return d
}
|
[
"func",
"(",
"d",
"*",
"Duration",
")",
"NotSet",
"(",
")",
"*",
"Duration",
"{",
"if",
"d",
".",
"value",
"!=",
"nil",
"{",
"d",
".",
"chain",
".",
"fail",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"d",
"\n",
"}"
] |
// NotSet succeeds if Duration is not set.
|
[
"NotSet",
"succeeds",
"if",
"Duration",
"is",
"not",
"set",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/duration.go#L51-L56
|
8,439 |
gavv/httpexpect
|
_examples/websocket.go
|
WsHttpHandler
|
func WsHttpHandler(w http.ResponseWriter, r *http.Request) {
upgrader := &websocket.Upgrader{}
c, err := upgrader.Upgrade(w, r, nil)
if err != nil {
panic(err)
}
defer c.Close()
for {
mt, message, err := c.ReadMessage()
if err != nil {
break
}
err = c.WriteMessage(mt, message)
if err != nil {
break
}
}
}
|
go
|
func WsHttpHandler(w http.ResponseWriter, r *http.Request) {
upgrader := &websocket.Upgrader{}
c, err := upgrader.Upgrade(w, r, nil)
if err != nil {
panic(err)
}
defer c.Close()
for {
mt, message, err := c.ReadMessage()
if err != nil {
break
}
err = c.WriteMessage(mt, message)
if err != nil {
break
}
}
}
|
[
"func",
"WsHttpHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"upgrader",
":=",
"&",
"websocket",
".",
"Upgrader",
"{",
"}",
"\n",
"c",
",",
"err",
":=",
"upgrader",
".",
"Upgrade",
"(",
"w",
",",
"r",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"defer",
"c",
".",
"Close",
"(",
")",
"\n",
"for",
"{",
"mt",
",",
"message",
",",
"err",
":=",
"c",
".",
"ReadMessage",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"break",
"\n",
"}",
"\n",
"err",
"=",
"c",
".",
"WriteMessage",
"(",
"mt",
",",
"message",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
// WsHttpHandler is a simple http.Handler that implements WebSocket echo server.
|
[
"WsHttpHandler",
"is",
"a",
"simple",
"http",
".",
"Handler",
"that",
"implements",
"WebSocket",
"echo",
"server",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/_examples/websocket.go#L13-L30
|
8,440 |
gavv/httpexpect
|
_examples/websocket.go
|
WsFastHandler
|
func WsFastHandler(ctx *fasthttp.RequestCtx) {
upgrader := fastwebsocket.New(func(c *fastwebsocket.Conn) {
defer c.Close()
for {
mt, message, err := c.ReadMessage()
if err != nil {
break
}
err = c.WriteMessage(mt, message)
if err != nil {
break
}
}
})
err := upgrader.Upgrade(ctx)
if err != nil {
panic(err)
}
}
|
go
|
func WsFastHandler(ctx *fasthttp.RequestCtx) {
upgrader := fastwebsocket.New(func(c *fastwebsocket.Conn) {
defer c.Close()
for {
mt, message, err := c.ReadMessage()
if err != nil {
break
}
err = c.WriteMessage(mt, message)
if err != nil {
break
}
}
})
err := upgrader.Upgrade(ctx)
if err != nil {
panic(err)
}
}
|
[
"func",
"WsFastHandler",
"(",
"ctx",
"*",
"fasthttp",
".",
"RequestCtx",
")",
"{",
"upgrader",
":=",
"fastwebsocket",
".",
"New",
"(",
"func",
"(",
"c",
"*",
"fastwebsocket",
".",
"Conn",
")",
"{",
"defer",
"c",
".",
"Close",
"(",
")",
"\n",
"for",
"{",
"mt",
",",
"message",
",",
"err",
":=",
"c",
".",
"ReadMessage",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"break",
"\n",
"}",
"\n",
"err",
"=",
"c",
".",
"WriteMessage",
"(",
"mt",
",",
"message",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
")",
"\n",
"err",
":=",
"upgrader",
".",
"Upgrade",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
// WsFastHandler is a simple fasthttp.RequestHandler that implements
// WebSocket echo server.
|
[
"WsFastHandler",
"is",
"a",
"simple",
"fasthttp",
".",
"RequestHandler",
"that",
"implements",
"WebSocket",
"echo",
"server",
"."
] |
82350969d5d20e9048a418cb62407d31bf74e953
|
https://github.com/gavv/httpexpect/blob/82350969d5d20e9048a418cb62407d31bf74e953/_examples/websocket.go#L34-L52
|
8,441 |
oschwald/geoip2-golang
|
reader.go
|
Open
|
func Open(file string) (*Reader, error) {
reader, err := maxminddb.Open(file)
if err != nil {
return nil, err
}
dbType, err := getDBType(reader)
return &Reader{reader, dbType}, err
}
|
go
|
func Open(file string) (*Reader, error) {
reader, err := maxminddb.Open(file)
if err != nil {
return nil, err
}
dbType, err := getDBType(reader)
return &Reader{reader, dbType}, err
}
|
[
"func",
"Open",
"(",
"file",
"string",
")",
"(",
"*",
"Reader",
",",
"error",
")",
"{",
"reader",
",",
"err",
":=",
"maxminddb",
".",
"Open",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"dbType",
",",
"err",
":=",
"getDBType",
"(",
"reader",
")",
"\n",
"return",
"&",
"Reader",
"{",
"reader",
",",
"dbType",
"}",
",",
"err",
"\n",
"}"
] |
// Open takes a string path to a file and returns a Reader struct or an error.
// The database file is opened using a memory map. Use the Close method on the
// Reader object to return the resources to the system.
|
[
"Open",
"takes",
"a",
"string",
"path",
"to",
"a",
"file",
"and",
"returns",
"a",
"Reader",
"struct",
"or",
"an",
"error",
".",
"The",
"database",
"file",
"is",
"opened",
"using",
"a",
"memory",
"map",
".",
"Use",
"the",
"Close",
"method",
"on",
"the",
"Reader",
"object",
"to",
"return",
"the",
"resources",
"to",
"the",
"system",
"."
] |
42d566f218c8e6131d26c31d07a294c4c7eecfd8
|
https://github.com/oschwald/geoip2-golang/blob/42d566f218c8e6131d26c31d07a294c4c7eecfd8/reader.go#L184-L191
|
8,442 |
signintech/gopdf
|
subfont_descriptor_obj.go
|
DesignUnitsToPdf
|
func DesignUnitsToPdf(val int, unitsPerEm uint) int {
return core.Round(float64(float64(val) * 1000.00 / float64(unitsPerEm)))
}
|
go
|
func DesignUnitsToPdf(val int, unitsPerEm uint) int {
return core.Round(float64(float64(val) * 1000.00 / float64(unitsPerEm)))
}
|
[
"func",
"DesignUnitsToPdf",
"(",
"val",
"int",
",",
"unitsPerEm",
"uint",
")",
"int",
"{",
"return",
"core",
".",
"Round",
"(",
"float64",
"(",
"float64",
"(",
"val",
")",
"*",
"1000.00",
"/",
"float64",
"(",
"unitsPerEm",
")",
")",
")",
"\n",
"}"
] |
//DesignUnitsToPdf convert unit
|
[
"DesignUnitsToPdf",
"convert",
"unit"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/subfont_descriptor_obj.go#L57-L59
|
8,443 |
signintech/gopdf
|
image_obj.go
|
SetImagePath
|
func (i *ImageObj) SetImagePath(path string) error {
file, err := os.Open(path)
if err != nil {
return err
}
defer file.Close()
err = i.SetImage(file)
if err != nil {
return err
}
return nil
}
|
go
|
func (i *ImageObj) SetImagePath(path string) error {
file, err := os.Open(path)
if err != nil {
return err
}
defer file.Close()
err = i.SetImage(file)
if err != nil {
return err
}
return nil
}
|
[
"func",
"(",
"i",
"*",
"ImageObj",
")",
"SetImagePath",
"(",
"path",
"string",
")",
"error",
"{",
"file",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"file",
".",
"Close",
"(",
")",
"\n\n",
"err",
"=",
"i",
".",
"SetImage",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
//SetImagePath set image path
|
[
"SetImagePath",
"set",
"image",
"path"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/image_obj.go#L93-L106
|
8,444 |
signintech/gopdf
|
image_obj.go
|
SetImage
|
func (i *ImageObj) SetImage(r io.Reader) error {
data, err := ioutil.ReadAll(r)
if err != nil {
return err
}
i.rawImgReader = bytes.NewReader(data)
return nil
}
|
go
|
func (i *ImageObj) SetImage(r io.Reader) error {
data, err := ioutil.ReadAll(r)
if err != nil {
return err
}
i.rawImgReader = bytes.NewReader(data)
return nil
}
|
[
"func",
"(",
"i",
"*",
"ImageObj",
")",
"SetImage",
"(",
"r",
"io",
".",
"Reader",
")",
"error",
"{",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"i",
".",
"rawImgReader",
"=",
"bytes",
".",
"NewReader",
"(",
"data",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
//SetImage set image
|
[
"SetImage",
"set",
"image"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/image_obj.go#L109-L118
|
8,445 |
signintech/gopdf
|
subset_font_obj.go
|
KernValueByLeft
|
func (s *SubsetFontObj) KernValueByLeft(left uint) (bool, *core.KernValue) {
if !s.ttfFontOption.UseKerning {
return false, nil
}
k := s.ttfp.Kern()
if k == nil {
return false, nil
}
if kval, ok := k.Kerning[left]; ok {
return true, &kval
}
return false, nil
}
|
go
|
func (s *SubsetFontObj) KernValueByLeft(left uint) (bool, *core.KernValue) {
if !s.ttfFontOption.UseKerning {
return false, nil
}
k := s.ttfp.Kern()
if k == nil {
return false, nil
}
if kval, ok := k.Kerning[left]; ok {
return true, &kval
}
return false, nil
}
|
[
"func",
"(",
"s",
"*",
"SubsetFontObj",
")",
"KernValueByLeft",
"(",
"left",
"uint",
")",
"(",
"bool",
",",
"*",
"core",
".",
"KernValue",
")",
"{",
"if",
"!",
"s",
".",
"ttfFontOption",
".",
"UseKerning",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n\n",
"k",
":=",
"s",
".",
"ttfp",
".",
"Kern",
"(",
")",
"\n",
"if",
"k",
"==",
"nil",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"kval",
",",
"ok",
":=",
"k",
".",
"Kerning",
"[",
"left",
"]",
";",
"ok",
"{",
"return",
"true",
",",
"&",
"kval",
"\n",
"}",
"\n\n",
"return",
"false",
",",
"nil",
"\n",
"}"
] |
//KernValueByLeft find kern value from kern table by left
|
[
"KernValueByLeft",
"find",
"kern",
"value",
"from",
"kern",
"table",
"by",
"left"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/subset_font_obj.go#L76-L92
|
8,446 |
signintech/gopdf
|
subset_font_obj.go
|
SetTTFByPath
|
func (s *SubsetFontObj) SetTTFByPath(ttfpath string) error {
useKerning := s.ttfFontOption.UseKerning
s.ttfp.SetUseKerning(useKerning)
err := s.ttfp.Parse(ttfpath)
if err != nil {
return err
}
return nil
}
|
go
|
func (s *SubsetFontObj) SetTTFByPath(ttfpath string) error {
useKerning := s.ttfFontOption.UseKerning
s.ttfp.SetUseKerning(useKerning)
err := s.ttfp.Parse(ttfpath)
if err != nil {
return err
}
return nil
}
|
[
"func",
"(",
"s",
"*",
"SubsetFontObj",
")",
"SetTTFByPath",
"(",
"ttfpath",
"string",
")",
"error",
"{",
"useKerning",
":=",
"s",
".",
"ttfFontOption",
".",
"UseKerning",
"\n",
"s",
".",
"ttfp",
".",
"SetUseKerning",
"(",
"useKerning",
")",
"\n",
"err",
":=",
"s",
".",
"ttfp",
".",
"Parse",
"(",
"ttfpath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
//SetTTFByPath set ttf
|
[
"SetTTFByPath",
"set",
"ttf"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/subset_font_obj.go#L95-L103
|
8,447 |
signintech/gopdf
|
subset_font_obj.go
|
SetTTFByReader
|
func (s *SubsetFontObj) SetTTFByReader(rd io.Reader) error {
useKerning := s.ttfFontOption.UseKerning
s.ttfp.SetUseKerning(useKerning)
err := s.ttfp.ParseByReader(rd)
if err != nil {
return err
}
return nil
}
|
go
|
func (s *SubsetFontObj) SetTTFByReader(rd io.Reader) error {
useKerning := s.ttfFontOption.UseKerning
s.ttfp.SetUseKerning(useKerning)
err := s.ttfp.ParseByReader(rd)
if err != nil {
return err
}
return nil
}
|
[
"func",
"(",
"s",
"*",
"SubsetFontObj",
")",
"SetTTFByReader",
"(",
"rd",
"io",
".",
"Reader",
")",
"error",
"{",
"useKerning",
":=",
"s",
".",
"ttfFontOption",
".",
"UseKerning",
"\n",
"s",
".",
"ttfp",
".",
"SetUseKerning",
"(",
"useKerning",
")",
"\n",
"err",
":=",
"s",
".",
"ttfp",
".",
"ParseByReader",
"(",
"rd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
//SetTTFByReader set ttf
|
[
"SetTTFByReader",
"set",
"ttf"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/subset_font_obj.go#L106-L114
|
8,448 |
signintech/gopdf
|
subset_font_obj.go
|
AddChars
|
func (s *SubsetFontObj) AddChars(txt string) error {
for _, runeValue := range txt {
if s.CharacterToGlyphIndex.KeyExists(runeValue) {
continue
}
glyphIndex, err := s.CharCodeToGlyphIndex(runeValue)
if err != nil {
return err
}
s.CharacterToGlyphIndex.Set(runeValue, glyphIndex) // [runeValue] = glyphIndex
}
return nil
}
|
go
|
func (s *SubsetFontObj) AddChars(txt string) error {
for _, runeValue := range txt {
if s.CharacterToGlyphIndex.KeyExists(runeValue) {
continue
}
glyphIndex, err := s.CharCodeToGlyphIndex(runeValue)
if err != nil {
return err
}
s.CharacterToGlyphIndex.Set(runeValue, glyphIndex) // [runeValue] = glyphIndex
}
return nil
}
|
[
"func",
"(",
"s",
"*",
"SubsetFontObj",
")",
"AddChars",
"(",
"txt",
"string",
")",
"error",
"{",
"for",
"_",
",",
"runeValue",
":=",
"range",
"txt",
"{",
"if",
"s",
".",
"CharacterToGlyphIndex",
".",
"KeyExists",
"(",
"runeValue",
")",
"{",
"continue",
"\n",
"}",
"\n",
"glyphIndex",
",",
"err",
":=",
"s",
".",
"CharCodeToGlyphIndex",
"(",
"runeValue",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"s",
".",
"CharacterToGlyphIndex",
".",
"Set",
"(",
"runeValue",
",",
"glyphIndex",
")",
"// [runeValue] = glyphIndex",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
//AddChars add char to map CharacterToGlyphIndex
|
[
"AddChars",
"add",
"char",
"to",
"map",
"CharacterToGlyphIndex"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/subset_font_obj.go#L117-L129
|
8,449 |
signintech/gopdf
|
subset_font_obj.go
|
CharIndex
|
func (s *SubsetFontObj) CharIndex(r rune) (uint, error) {
/*
if index, ok := s.CharacterToGlyphIndex[r]; ok {
return index, nil
}
return 0, ErrCharNotFound
*/
glyIndex, ok := s.CharacterToGlyphIndex.Val(r)
if ok {
return glyIndex, nil
}
return 0, ErrCharNotFound
}
|
go
|
func (s *SubsetFontObj) CharIndex(r rune) (uint, error) {
/*
if index, ok := s.CharacterToGlyphIndex[r]; ok {
return index, nil
}
return 0, ErrCharNotFound
*/
glyIndex, ok := s.CharacterToGlyphIndex.Val(r)
if ok {
return glyIndex, nil
}
return 0, ErrCharNotFound
}
|
[
"func",
"(",
"s",
"*",
"SubsetFontObj",
")",
"CharIndex",
"(",
"r",
"rune",
")",
"(",
"uint",
",",
"error",
")",
"{",
"/*\n\t\tif index, ok := s.CharacterToGlyphIndex[r]; ok {\n\t\t\treturn index, nil\n\t\t}\n\t\treturn 0, ErrCharNotFound\n\t*/",
"glyIndex",
",",
"ok",
":=",
"s",
".",
"CharacterToGlyphIndex",
".",
"Val",
"(",
"r",
")",
"\n",
"if",
"ok",
"{",
"return",
"glyIndex",
",",
"nil",
"\n",
"}",
"\n",
"return",
"0",
",",
"ErrCharNotFound",
"\n",
"}"
] |
//CharIndex index of char in glyph table
|
[
"CharIndex",
"index",
"of",
"char",
"in",
"glyph",
"table"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/subset_font_obj.go#L132-L144
|
8,450 |
signintech/gopdf
|
subset_font_obj.go
|
CharCodeToGlyphIndex
|
func (s *SubsetFontObj) CharCodeToGlyphIndex(r rune) (uint, error) {
value := uint64(r)
if value <= 0xFFFF {
gIndex, err := s.charCodeToGlyphIndexFormat4(r)
if err != nil {
return 0, err
}
return gIndex, nil
} else {
gIndex, err := s.charCodeToGlyphIndexFormat12(r)
if err != nil {
return 0, err
}
return gIndex, nil
}
}
|
go
|
func (s *SubsetFontObj) CharCodeToGlyphIndex(r rune) (uint, error) {
value := uint64(r)
if value <= 0xFFFF {
gIndex, err := s.charCodeToGlyphIndexFormat4(r)
if err != nil {
return 0, err
}
return gIndex, nil
} else {
gIndex, err := s.charCodeToGlyphIndexFormat12(r)
if err != nil {
return 0, err
}
return gIndex, nil
}
}
|
[
"func",
"(",
"s",
"*",
"SubsetFontObj",
")",
"CharCodeToGlyphIndex",
"(",
"r",
"rune",
")",
"(",
"uint",
",",
"error",
")",
"{",
"value",
":=",
"uint64",
"(",
"r",
")",
"\n",
"if",
"value",
"<=",
"0xFFFF",
"{",
"gIndex",
",",
"err",
":=",
"s",
".",
"charCodeToGlyphIndexFormat4",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"return",
"gIndex",
",",
"nil",
"\n",
"}",
"else",
"{",
"gIndex",
",",
"err",
":=",
"s",
".",
"charCodeToGlyphIndexFormat12",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"return",
"gIndex",
",",
"nil",
"\n",
"}",
"\n\n",
"}"
] |
//CharCodeToGlyphIndex get glyph index from char code
|
[
"CharCodeToGlyphIndex",
"get",
"glyph",
"index",
"from",
"char",
"code"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/subset_font_obj.go#L208-L225
|
8,451 |
signintech/gopdf
|
subset_font_obj.go
|
GlyphIndexToPdfWidth
|
func (s *SubsetFontObj) GlyphIndexToPdfWidth(glyphIndex uint) uint {
numberOfHMetrics := s.ttfp.NumberOfHMetrics()
unitsPerEm := s.ttfp.UnitsPerEm()
if glyphIndex >= numberOfHMetrics {
glyphIndex = numberOfHMetrics - 1
}
width := s.ttfp.Widths()[glyphIndex]
if unitsPerEm == 1000 {
return width
}
return width * 1000 / unitsPerEm
}
|
go
|
func (s *SubsetFontObj) GlyphIndexToPdfWidth(glyphIndex uint) uint {
numberOfHMetrics := s.ttfp.NumberOfHMetrics()
unitsPerEm := s.ttfp.UnitsPerEm()
if glyphIndex >= numberOfHMetrics {
glyphIndex = numberOfHMetrics - 1
}
width := s.ttfp.Widths()[glyphIndex]
if unitsPerEm == 1000 {
return width
}
return width * 1000 / unitsPerEm
}
|
[
"func",
"(",
"s",
"*",
"SubsetFontObj",
")",
"GlyphIndexToPdfWidth",
"(",
"glyphIndex",
"uint",
")",
"uint",
"{",
"numberOfHMetrics",
":=",
"s",
".",
"ttfp",
".",
"NumberOfHMetrics",
"(",
")",
"\n",
"unitsPerEm",
":=",
"s",
".",
"ttfp",
".",
"UnitsPerEm",
"(",
")",
"\n",
"if",
"glyphIndex",
">=",
"numberOfHMetrics",
"{",
"glyphIndex",
"=",
"numberOfHMetrics",
"-",
"1",
"\n",
"}",
"\n\n",
"width",
":=",
"s",
".",
"ttfp",
".",
"Widths",
"(",
")",
"[",
"glyphIndex",
"]",
"\n",
"if",
"unitsPerEm",
"==",
"1000",
"{",
"return",
"width",
"\n",
"}",
"\n",
"return",
"width",
"*",
"1000",
"/",
"unitsPerEm",
"\n",
"}"
] |
//GlyphIndexToPdfWidth get with from glyphIndex
|
[
"GlyphIndexToPdfWidth",
"get",
"with",
"from",
"glyphIndex"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/subset_font_obj.go#L228-L241
|
8,452 |
signintech/gopdf
|
pdf_dictionary_obj.go
|
AddCompositeGlyphs
|
func (p *PdfDictionaryObj) AddCompositeGlyphs(glyphArray *[]int, glyph int) {
start := p.GetOffset(int(glyph))
if start == p.GetOffset(int(glyph)+1) {
return
}
offset := start
ttfp := p.PtrToSubsetFontObj.GetTTFParser()
fontData := ttfp.FontData()
numContours, step := ReadShortFromByte(fontData, offset)
offset += step
if numContours >= 0 {
return
}
offset += 8
for {
flags, step1 := ReadUShortFromByte(fontData, offset)
offset += step1
cGlyph, step2 := ReadUShortFromByte(fontData, offset)
offset += step2
//check cGlyph is contain in glyphArray?
glyphContainsKey := false
for _, g := range *glyphArray {
if g == int(cGlyph) {
glyphContainsKey = true
break
}
}
if !glyphContainsKey {
*glyphArray = append(*glyphArray, int(cGlyph))
}
if (flags & MORE_COMPONENTS) == 0 {
return
}
offsetAppend := 4
if (flags & ARG_1_AND_2_ARE_WORDS) == 0 {
offsetAppend = 2
}
if (flags & WE_HAVE_A_SCALE) != 0 {
offsetAppend += 2
} else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0 {
offsetAppend += 4
}
if (flags & WE_HAVE_A_TWO_BY_TWO) != 0 {
offsetAppend += 8
}
offset += offsetAppend
}
}
|
go
|
func (p *PdfDictionaryObj) AddCompositeGlyphs(glyphArray *[]int, glyph int) {
start := p.GetOffset(int(glyph))
if start == p.GetOffset(int(glyph)+1) {
return
}
offset := start
ttfp := p.PtrToSubsetFontObj.GetTTFParser()
fontData := ttfp.FontData()
numContours, step := ReadShortFromByte(fontData, offset)
offset += step
if numContours >= 0 {
return
}
offset += 8
for {
flags, step1 := ReadUShortFromByte(fontData, offset)
offset += step1
cGlyph, step2 := ReadUShortFromByte(fontData, offset)
offset += step2
//check cGlyph is contain in glyphArray?
glyphContainsKey := false
for _, g := range *glyphArray {
if g == int(cGlyph) {
glyphContainsKey = true
break
}
}
if !glyphContainsKey {
*glyphArray = append(*glyphArray, int(cGlyph))
}
if (flags & MORE_COMPONENTS) == 0 {
return
}
offsetAppend := 4
if (flags & ARG_1_AND_2_ARE_WORDS) == 0 {
offsetAppend = 2
}
if (flags & WE_HAVE_A_SCALE) != 0 {
offsetAppend += 2
} else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0 {
offsetAppend += 4
}
if (flags & WE_HAVE_A_TWO_BY_TWO) != 0 {
offsetAppend += 8
}
offset += offsetAppend
}
}
|
[
"func",
"(",
"p",
"*",
"PdfDictionaryObj",
")",
"AddCompositeGlyphs",
"(",
"glyphArray",
"*",
"[",
"]",
"int",
",",
"glyph",
"int",
")",
"{",
"start",
":=",
"p",
".",
"GetOffset",
"(",
"int",
"(",
"glyph",
")",
")",
"\n",
"if",
"start",
"==",
"p",
".",
"GetOffset",
"(",
"int",
"(",
"glyph",
")",
"+",
"1",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"offset",
":=",
"start",
"\n",
"ttfp",
":=",
"p",
".",
"PtrToSubsetFontObj",
".",
"GetTTFParser",
"(",
")",
"\n",
"fontData",
":=",
"ttfp",
".",
"FontData",
"(",
")",
"\n",
"numContours",
",",
"step",
":=",
"ReadShortFromByte",
"(",
"fontData",
",",
"offset",
")",
"\n",
"offset",
"+=",
"step",
"\n",
"if",
"numContours",
">=",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"offset",
"+=",
"8",
"\n",
"for",
"{",
"flags",
",",
"step1",
":=",
"ReadUShortFromByte",
"(",
"fontData",
",",
"offset",
")",
"\n",
"offset",
"+=",
"step1",
"\n",
"cGlyph",
",",
"step2",
":=",
"ReadUShortFromByte",
"(",
"fontData",
",",
"offset",
")",
"\n",
"offset",
"+=",
"step2",
"\n",
"//check cGlyph is contain in glyphArray?",
"glyphContainsKey",
":=",
"false",
"\n",
"for",
"_",
",",
"g",
":=",
"range",
"*",
"glyphArray",
"{",
"if",
"g",
"==",
"int",
"(",
"cGlyph",
")",
"{",
"glyphContainsKey",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"glyphContainsKey",
"{",
"*",
"glyphArray",
"=",
"append",
"(",
"*",
"glyphArray",
",",
"int",
"(",
"cGlyph",
")",
")",
"\n",
"}",
"\n\n",
"if",
"(",
"flags",
"&",
"MORE_COMPONENTS",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n",
"offsetAppend",
":=",
"4",
"\n",
"if",
"(",
"flags",
"&",
"ARG_1_AND_2_ARE_WORDS",
")",
"==",
"0",
"{",
"offsetAppend",
"=",
"2",
"\n",
"}",
"\n",
"if",
"(",
"flags",
"&",
"WE_HAVE_A_SCALE",
")",
"!=",
"0",
"{",
"offsetAppend",
"+=",
"2",
"\n",
"}",
"else",
"if",
"(",
"flags",
"&",
"WE_HAVE_AN_X_AND_Y_SCALE",
")",
"!=",
"0",
"{",
"offsetAppend",
"+=",
"4",
"\n",
"}",
"\n",
"if",
"(",
"flags",
"&",
"WE_HAVE_A_TWO_BY_TWO",
")",
"!=",
"0",
"{",
"offsetAppend",
"+=",
"8",
"\n",
"}",
"\n",
"offset",
"+=",
"offsetAppend",
"\n",
"}",
"\n",
"}"
] |
//AddCompositeGlyphs add composite glyph
//composite glyph is a Unicode entity that can be defined as a sequence of one or more other characters.
|
[
"AddCompositeGlyphs",
"add",
"composite",
"glyph",
"composite",
"glyph",
"is",
"a",
"Unicode",
"entity",
"that",
"can",
"be",
"defined",
"as",
"a",
"sequence",
"of",
"one",
"or",
"more",
"other",
"characters",
"."
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/pdf_dictionary_obj.go#L277-L327
|
8,453 |
signintech/gopdf
|
pdf_dictionary_obj.go
|
GetOffset
|
func (p *PdfDictionaryObj) GetOffset(glyph int) int {
ttfp := p.PtrToSubsetFontObj.GetTTFParser()
glyf := ttfp.GetTables()["glyf"]
offset := int(glyf.Offset + ttfp.LocaTable[glyph])
return offset
}
|
go
|
func (p *PdfDictionaryObj) GetOffset(glyph int) int {
ttfp := p.PtrToSubsetFontObj.GetTTFParser()
glyf := ttfp.GetTables()["glyf"]
offset := int(glyf.Offset + ttfp.LocaTable[glyph])
return offset
}
|
[
"func",
"(",
"p",
"*",
"PdfDictionaryObj",
")",
"GetOffset",
"(",
"glyph",
"int",
")",
"int",
"{",
"ttfp",
":=",
"p",
".",
"PtrToSubsetFontObj",
".",
"GetTTFParser",
"(",
")",
"\n",
"glyf",
":=",
"ttfp",
".",
"GetTables",
"(",
")",
"[",
"\"",
"\"",
"]",
"\n",
"offset",
":=",
"int",
"(",
"glyf",
".",
"Offset",
"+",
"ttfp",
".",
"LocaTable",
"[",
"glyph",
"]",
")",
"\n",
"return",
"offset",
"\n",
"}"
] |
//GetOffset get offset from glyf table
|
[
"GetOffset",
"get",
"offset",
"from",
"glyf",
"table"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/pdf_dictionary_obj.go#L336-L341
|
8,454 |
signintech/gopdf
|
pdf_dictionary_obj.go
|
CheckSum
|
func CheckSum(data []byte) uint {
var byte3, byte2, byte1, byte0 uint64
byte3 = 0
byte2 = 0
byte1 = 0
byte0 = 0
length := len(data)
i := 0
for i < length {
byte3 += uint64(data[i])
i++
byte2 += uint64(data[i])
i++
byte1 += uint64(data[i])
i++
byte0 += uint64(data[i])
i++
}
//var result uint32
result := uint32(byte3<<24) + uint32(byte2<<16) + uint32(byte1<<8) + uint32(byte0)
return uint(result)
}
|
go
|
func CheckSum(data []byte) uint {
var byte3, byte2, byte1, byte0 uint64
byte3 = 0
byte2 = 0
byte1 = 0
byte0 = 0
length := len(data)
i := 0
for i < length {
byte3 += uint64(data[i])
i++
byte2 += uint64(data[i])
i++
byte1 += uint64(data[i])
i++
byte0 += uint64(data[i])
i++
}
//var result uint32
result := uint32(byte3<<24) + uint32(byte2<<16) + uint32(byte1<<8) + uint32(byte0)
return uint(result)
}
|
[
"func",
"CheckSum",
"(",
"data",
"[",
"]",
"byte",
")",
"uint",
"{",
"var",
"byte3",
",",
"byte2",
",",
"byte1",
",",
"byte0",
"uint64",
"\n",
"byte3",
"=",
"0",
"\n",
"byte2",
"=",
"0",
"\n",
"byte1",
"=",
"0",
"\n",
"byte0",
"=",
"0",
"\n",
"length",
":=",
"len",
"(",
"data",
")",
"\n",
"i",
":=",
"0",
"\n",
"for",
"i",
"<",
"length",
"{",
"byte3",
"+=",
"uint64",
"(",
"data",
"[",
"i",
"]",
")",
"\n",
"i",
"++",
"\n",
"byte2",
"+=",
"uint64",
"(",
"data",
"[",
"i",
"]",
")",
"\n",
"i",
"++",
"\n",
"byte1",
"+=",
"uint64",
"(",
"data",
"[",
"i",
"]",
")",
"\n",
"i",
"++",
"\n",
"byte0",
"+=",
"uint64",
"(",
"data",
"[",
"i",
"]",
")",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"//var result uint32",
"result",
":=",
"uint32",
"(",
"byte3",
"<<",
"24",
")",
"+",
"uint32",
"(",
"byte2",
"<<",
"16",
")",
"+",
"uint32",
"(",
"byte1",
"<<",
"8",
")",
"+",
"uint32",
"(",
"byte0",
")",
"\n",
"return",
"uint",
"(",
"result",
")",
"\n",
"}"
] |
//CheckSum check sum
|
[
"CheckSum",
"check",
"sum"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/pdf_dictionary_obj.go#L344-L366
|
8,455 |
signintech/gopdf
|
margin.go
|
SetMargins
|
func (gp *GoPdf) SetMargins(left, top, right, bottom float64) {
gp.UnitsToPointsVar(&left, &top, &right, &bottom)
gp.margins = Margins{left, top, right, bottom}
}
|
go
|
func (gp *GoPdf) SetMargins(left, top, right, bottom float64) {
gp.UnitsToPointsVar(&left, &top, &right, &bottom)
gp.margins = Margins{left, top, right, bottom}
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"SetMargins",
"(",
"left",
",",
"top",
",",
"right",
",",
"bottom",
"float64",
")",
"{",
"gp",
".",
"UnitsToPointsVar",
"(",
"&",
"left",
",",
"&",
"top",
",",
"&",
"right",
",",
"&",
"bottom",
")",
"\n",
"gp",
".",
"margins",
"=",
"Margins",
"{",
"left",
",",
"top",
",",
"right",
",",
"bottom",
"}",
"\n",
"}"
] |
// SetMargins defines the left, top, right and bottom margins. By default, they equal 1 cm. Call this method to change them.
|
[
"SetMargins",
"defines",
"the",
"left",
"top",
"right",
"and",
"bottom",
"margins",
".",
"By",
"default",
"they",
"equal",
"1",
"cm",
".",
"Call",
"this",
"method",
"to",
"change",
"them",
"."
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/margin.go#L20-L23
|
8,456 |
signintech/gopdf
|
margin.go
|
SetMarginLeft
|
func (gp *GoPdf) SetMarginLeft(margin float64) {
gp.margins.Left = gp.UnitsToPoints(margin)
}
|
go
|
func (gp *GoPdf) SetMarginLeft(margin float64) {
gp.margins.Left = gp.UnitsToPoints(margin)
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"SetMarginLeft",
"(",
"margin",
"float64",
")",
"{",
"gp",
".",
"margins",
".",
"Left",
"=",
"gp",
".",
"UnitsToPoints",
"(",
"margin",
")",
"\n",
"}"
] |
// SetMarginLeft sets the left margin
|
[
"SetMarginLeft",
"sets",
"the",
"left",
"margin"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/margin.go#L26-L28
|
8,457 |
signintech/gopdf
|
margin.go
|
SetMarginTop
|
func (gp *GoPdf) SetMarginTop(margin float64) {
gp.margins.Top = gp.UnitsToPoints(margin)
}
|
go
|
func (gp *GoPdf) SetMarginTop(margin float64) {
gp.margins.Top = gp.UnitsToPoints(margin)
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"SetMarginTop",
"(",
"margin",
"float64",
")",
"{",
"gp",
".",
"margins",
".",
"Top",
"=",
"gp",
".",
"UnitsToPoints",
"(",
"margin",
")",
"\n",
"}"
] |
// SetMarginTop sets the top margin
|
[
"SetMarginTop",
"sets",
"the",
"top",
"margin"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/margin.go#L31-L33
|
8,458 |
signintech/gopdf
|
margin.go
|
SetMarginRight
|
func (gp *GoPdf) SetMarginRight(margin float64) {
gp.margins.Right = gp.UnitsToPoints(margin)
}
|
go
|
func (gp *GoPdf) SetMarginRight(margin float64) {
gp.margins.Right = gp.UnitsToPoints(margin)
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"SetMarginRight",
"(",
"margin",
"float64",
")",
"{",
"gp",
".",
"margins",
".",
"Right",
"=",
"gp",
".",
"UnitsToPoints",
"(",
"margin",
")",
"\n",
"}"
] |
// SetMarginRight sets the right margin
|
[
"SetMarginRight",
"sets",
"the",
"right",
"margin"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/margin.go#L36-L38
|
8,459 |
signintech/gopdf
|
margin.go
|
SetMarginBottom
|
func (gp *GoPdf) SetMarginBottom(margin float64) {
gp.margins.Bottom = gp.UnitsToPoints(margin)
}
|
go
|
func (gp *GoPdf) SetMarginBottom(margin float64) {
gp.margins.Bottom = gp.UnitsToPoints(margin)
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"SetMarginBottom",
"(",
"margin",
"float64",
")",
"{",
"gp",
".",
"margins",
".",
"Bottom",
"=",
"gp",
".",
"UnitsToPoints",
"(",
"margin",
")",
"\n",
"}"
] |
// SetMarginBottom set the bottom margin
|
[
"SetMarginBottom",
"set",
"the",
"bottom",
"margin"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/margin.go#L41-L43
|
8,460 |
signintech/gopdf
|
margin.go
|
Margins
|
func (gp *GoPdf) Margins() (float64, float64, float64, float64) {
return gp.PointsToUnits(gp.margins.Left),
gp.PointsToUnits(gp.margins.Top),
gp.PointsToUnits(gp.margins.Right),
gp.PointsToUnits(gp.margins.Bottom)
}
|
go
|
func (gp *GoPdf) Margins() (float64, float64, float64, float64) {
return gp.PointsToUnits(gp.margins.Left),
gp.PointsToUnits(gp.margins.Top),
gp.PointsToUnits(gp.margins.Right),
gp.PointsToUnits(gp.margins.Bottom)
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"Margins",
"(",
")",
"(",
"float64",
",",
"float64",
",",
"float64",
",",
"float64",
")",
"{",
"return",
"gp",
".",
"PointsToUnits",
"(",
"gp",
".",
"margins",
".",
"Left",
")",
",",
"gp",
".",
"PointsToUnits",
"(",
"gp",
".",
"margins",
".",
"Top",
")",
",",
"gp",
".",
"PointsToUnits",
"(",
"gp",
".",
"margins",
".",
"Right",
")",
",",
"gp",
".",
"PointsToUnits",
"(",
"gp",
".",
"margins",
".",
"Bottom",
")",
"\n",
"}"
] |
// Margins gets the current margins, The margins will be converted back to the documents units. Returned values will be in the following order Left, Top, Right, Bottom
|
[
"Margins",
"gets",
"the",
"current",
"margins",
"The",
"margins",
"will",
"be",
"converted",
"back",
"to",
"the",
"documents",
"units",
".",
"Returned",
"values",
"will",
"be",
"in",
"the",
"following",
"order",
"Left",
"Top",
"Right",
"Bottom"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/margin.go#L46-L51
|
8,461 |
signintech/gopdf
|
fontmaker/core/kern_table.go
|
ValueByRight
|
func (k KernValue) ValueByRight(right uint) (bool, int16) {
if val, ok := k[uint(right)]; ok {
return true, val
}
return false, 0
}
|
go
|
func (k KernValue) ValueByRight(right uint) (bool, int16) {
if val, ok := k[uint(right)]; ok {
return true, val
}
return false, 0
}
|
[
"func",
"(",
"k",
"KernValue",
")",
"ValueByRight",
"(",
"right",
"uint",
")",
"(",
"bool",
",",
"int16",
")",
"{",
"if",
"val",
",",
"ok",
":=",
"k",
"[",
"uint",
"(",
"right",
")",
"]",
";",
"ok",
"{",
"return",
"true",
",",
"val",
"\n",
"}",
"\n",
"return",
"false",
",",
"0",
"\n",
"}"
] |
//ValueByRight get value by right
|
[
"ValueByRight",
"get",
"value",
"by",
"right"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/fontmaker/core/kern_table.go#L17-L22
|
8,462 |
signintech/gopdf
|
buff_write.go
|
WriteUInt32
|
func WriteUInt32(w io.Writer, v uint) error {
a := byte(v >> 24)
b := byte(v >> 16)
c := byte(v >> 8)
d := byte(v)
_, err := w.Write([]byte{a, b, c, d})
if err != nil {
return err
}
return nil
}
|
go
|
func WriteUInt32(w io.Writer, v uint) error {
a := byte(v >> 24)
b := byte(v >> 16)
c := byte(v >> 8)
d := byte(v)
_, err := w.Write([]byte{a, b, c, d})
if err != nil {
return err
}
return nil
}
|
[
"func",
"WriteUInt32",
"(",
"w",
"io",
".",
"Writer",
",",
"v",
"uint",
")",
"error",
"{",
"a",
":=",
"byte",
"(",
"v",
">>",
"24",
")",
"\n",
"b",
":=",
"byte",
"(",
"v",
">>",
"16",
")",
"\n",
"c",
":=",
"byte",
"(",
"v",
">>",
"8",
")",
"\n",
"d",
":=",
"byte",
"(",
"v",
")",
"\n",
"_",
",",
"err",
":=",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"{",
"a",
",",
"b",
",",
"c",
",",
"d",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
//WriteUInt32 writes a 32-bit unsigned integer value to w io.Writer
|
[
"WriteUInt32",
"writes",
"a",
"32",
"-",
"bit",
"unsigned",
"integer",
"value",
"to",
"w",
"io",
".",
"Writer"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/buff_write.go#L6-L16
|
8,463 |
signintech/gopdf
|
buff_write.go
|
WriteUInt16
|
func WriteUInt16(w io.Writer, v uint) error {
a := byte(v >> 8)
b := byte(v)
_, err := w.Write([]byte{a, b})
if err != nil {
return err
}
return nil
}
|
go
|
func WriteUInt16(w io.Writer, v uint) error {
a := byte(v >> 8)
b := byte(v)
_, err := w.Write([]byte{a, b})
if err != nil {
return err
}
return nil
}
|
[
"func",
"WriteUInt16",
"(",
"w",
"io",
".",
"Writer",
",",
"v",
"uint",
")",
"error",
"{",
"a",
":=",
"byte",
"(",
"v",
">>",
"8",
")",
"\n",
"b",
":=",
"byte",
"(",
"v",
")",
"\n",
"_",
",",
"err",
":=",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"{",
"a",
",",
"b",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
//WriteUInt16 writes a 16-bit unsigned integer value to w io.Writer
|
[
"WriteUInt16",
"writes",
"a",
"16",
"-",
"bit",
"unsigned",
"integer",
"value",
"to",
"w",
"io",
".",
"Writer"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/buff_write.go#L19-L28
|
8,464 |
signintech/gopdf
|
buff_write.go
|
WriteTag
|
func WriteTag(w io.Writer, tag string) error {
b := []byte(tag)
_, err := w.Write(b)
if err != nil {
return err
}
return nil
}
|
go
|
func WriteTag(w io.Writer, tag string) error {
b := []byte(tag)
_, err := w.Write(b)
if err != nil {
return err
}
return nil
}
|
[
"func",
"WriteTag",
"(",
"w",
"io",
".",
"Writer",
",",
"tag",
"string",
")",
"error",
"{",
"b",
":=",
"[",
"]",
"byte",
"(",
"tag",
")",
"\n",
"_",
",",
"err",
":=",
"w",
".",
"Write",
"(",
"b",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
//WriteTag writes string value to w io.Writer
|
[
"WriteTag",
"writes",
"string",
"value",
"to",
"w",
"io",
".",
"Writer"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/buff_write.go#L31-L38
|
8,465 |
signintech/gopdf
|
map_of_character_To_glyph_index.go
|
NewMapOfCharacterToGlyphIndex
|
func NewMapOfCharacterToGlyphIndex() *MapOfCharacterToGlyphIndex {
var m MapOfCharacterToGlyphIndex
m.keyIndexs = make(map[rune]int)
return &m
}
|
go
|
func NewMapOfCharacterToGlyphIndex() *MapOfCharacterToGlyphIndex {
var m MapOfCharacterToGlyphIndex
m.keyIndexs = make(map[rune]int)
return &m
}
|
[
"func",
"NewMapOfCharacterToGlyphIndex",
"(",
")",
"*",
"MapOfCharacterToGlyphIndex",
"{",
"var",
"m",
"MapOfCharacterToGlyphIndex",
"\n",
"m",
".",
"keyIndexs",
"=",
"make",
"(",
"map",
"[",
"rune",
"]",
"int",
")",
"\n",
"return",
"&",
"m",
"\n",
"}"
] |
//NewMapOfCharacterToGlyphIndex new CharacterToGlyphIndex
|
[
"NewMapOfCharacterToGlyphIndex",
"new",
"CharacterToGlyphIndex"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/map_of_character_To_glyph_index.go#L11-L15
|
8,466 |
signintech/gopdf
|
map_of_character_To_glyph_index.go
|
KeyExists
|
func (m *MapOfCharacterToGlyphIndex) KeyExists(k rune) bool {
/*for _, key := range m.Keys {
if k == key {
return true
}
}*/
if _, ok := m.keyIndexs[k]; ok {
return true
}
return false
}
|
go
|
func (m *MapOfCharacterToGlyphIndex) KeyExists(k rune) bool {
/*for _, key := range m.Keys {
if k == key {
return true
}
}*/
if _, ok := m.keyIndexs[k]; ok {
return true
}
return false
}
|
[
"func",
"(",
"m",
"*",
"MapOfCharacterToGlyphIndex",
")",
"KeyExists",
"(",
"k",
"rune",
")",
"bool",
"{",
"/*for _, key := range m.Keys {\n\t\tif k == key {\n\t\t\treturn true\n\t\t}\n\t}*/",
"if",
"_",
",",
"ok",
":=",
"m",
".",
"keyIndexs",
"[",
"k",
"]",
";",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
//KeyExists key is exists?
|
[
"KeyExists",
"key",
"is",
"exists?"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/map_of_character_To_glyph_index.go#L18-L28
|
8,467 |
signintech/gopdf
|
map_of_character_To_glyph_index.go
|
Set
|
func (m *MapOfCharacterToGlyphIndex) Set(k rune, v uint) {
m.keyIndexs[k] = len(m.Keys)
m.Keys = append(m.Keys, k)
m.Vals = append(m.Vals, v)
}
|
go
|
func (m *MapOfCharacterToGlyphIndex) Set(k rune, v uint) {
m.keyIndexs[k] = len(m.Keys)
m.Keys = append(m.Keys, k)
m.Vals = append(m.Vals, v)
}
|
[
"func",
"(",
"m",
"*",
"MapOfCharacterToGlyphIndex",
")",
"Set",
"(",
"k",
"rune",
",",
"v",
"uint",
")",
"{",
"m",
".",
"keyIndexs",
"[",
"k",
"]",
"=",
"len",
"(",
"m",
".",
"Keys",
")",
"\n",
"m",
".",
"Keys",
"=",
"append",
"(",
"m",
".",
"Keys",
",",
"k",
")",
"\n",
"m",
".",
"Vals",
"=",
"append",
"(",
"m",
".",
"Vals",
",",
"v",
")",
"\n",
"}"
] |
//Set set key and value to map
|
[
"Set",
"set",
"key",
"and",
"value",
"to",
"map"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/map_of_character_To_glyph_index.go#L31-L35
|
8,468 |
signintech/gopdf
|
map_of_character_To_glyph_index.go
|
Index
|
func (m *MapOfCharacterToGlyphIndex) Index(k rune) (int, bool) {
/*for i, key := range m.Keys {
if k == key {
return i, true
}
}*/
if index, ok := m.keyIndexs[k]; ok {
return index, true
}
return -1, false
}
|
go
|
func (m *MapOfCharacterToGlyphIndex) Index(k rune) (int, bool) {
/*for i, key := range m.Keys {
if k == key {
return i, true
}
}*/
if index, ok := m.keyIndexs[k]; ok {
return index, true
}
return -1, false
}
|
[
"func",
"(",
"m",
"*",
"MapOfCharacterToGlyphIndex",
")",
"Index",
"(",
"k",
"rune",
")",
"(",
"int",
",",
"bool",
")",
"{",
"/*for i, key := range m.Keys {\n\t\tif k == key {\n\t\t\treturn i, true\n\t\t}\n\t}*/",
"if",
"index",
",",
"ok",
":=",
"m",
".",
"keyIndexs",
"[",
"k",
"]",
";",
"ok",
"{",
"return",
"index",
",",
"true",
"\n",
"}",
"\n",
"return",
"-",
"1",
",",
"false",
"\n",
"}"
] |
//Index get index by key
|
[
"Index",
"get",
"index",
"by",
"key"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/map_of_character_To_glyph_index.go#L38-L48
|
8,469 |
signintech/gopdf
|
map_of_character_To_glyph_index.go
|
Val
|
func (m *MapOfCharacterToGlyphIndex) Val(k rune) (uint, bool) {
i, ok := m.Index(k)
if !ok {
return 0, false
}
return m.Vals[i], true
}
|
go
|
func (m *MapOfCharacterToGlyphIndex) Val(k rune) (uint, bool) {
i, ok := m.Index(k)
if !ok {
return 0, false
}
return m.Vals[i], true
}
|
[
"func",
"(",
"m",
"*",
"MapOfCharacterToGlyphIndex",
")",
"Val",
"(",
"k",
"rune",
")",
"(",
"uint",
",",
"bool",
")",
"{",
"i",
",",
"ok",
":=",
"m",
".",
"Index",
"(",
"k",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"m",
".",
"Vals",
"[",
"i",
"]",
",",
"true",
"\n",
"}"
] |
//Val get value by Key
|
[
"Val",
"get",
"value",
"by",
"Key"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/map_of_character_To_glyph_index.go#L51-L57
|
8,470 |
signintech/gopdf
|
content_obj.go
|
AppendStreamText
|
func (c *ContentObj) AppendStreamText(text string) error {
//support only CURRENT_FONT_TYPE_SUBSET
textColor := c.getRoot().curr.textColor()
grayFill := c.getRoot().curr.grayFill
fontCountIndex := c.getRoot().curr.Font_FontCount + 1
fontSize := c.getRoot().curr.Font_Size
fontStyle := c.getRoot().curr.Font_Style
x := c.getRoot().curr.X
y := c.getRoot().curr.Y
setXCount := c.getRoot().curr.setXCount
fontSubset := c.getRoot().curr.Font_ISubset
cache := cacheContentText{
fontSubset: fontSubset,
rectangle: nil,
textColor: textColor,
grayFill: grayFill,
fontCountIndex: fontCountIndex,
fontSize: fontSize,
fontStyle: fontStyle,
setXCount: setXCount,
x: x,
y: y,
pageheight: c.getRoot().curr.pageSize.H,
contentType: ContentTypeText,
lineWidth: c.getRoot().curr.lineWidth,
}
var err error
c.getRoot().curr.X, c.getRoot().curr.Y, err = c.listCache.appendContentText(cache, text)
if err != nil {
return err
}
return nil
}
|
go
|
func (c *ContentObj) AppendStreamText(text string) error {
//support only CURRENT_FONT_TYPE_SUBSET
textColor := c.getRoot().curr.textColor()
grayFill := c.getRoot().curr.grayFill
fontCountIndex := c.getRoot().curr.Font_FontCount + 1
fontSize := c.getRoot().curr.Font_Size
fontStyle := c.getRoot().curr.Font_Style
x := c.getRoot().curr.X
y := c.getRoot().curr.Y
setXCount := c.getRoot().curr.setXCount
fontSubset := c.getRoot().curr.Font_ISubset
cache := cacheContentText{
fontSubset: fontSubset,
rectangle: nil,
textColor: textColor,
grayFill: grayFill,
fontCountIndex: fontCountIndex,
fontSize: fontSize,
fontStyle: fontStyle,
setXCount: setXCount,
x: x,
y: y,
pageheight: c.getRoot().curr.pageSize.H,
contentType: ContentTypeText,
lineWidth: c.getRoot().curr.lineWidth,
}
var err error
c.getRoot().curr.X, c.getRoot().curr.Y, err = c.listCache.appendContentText(cache, text)
if err != nil {
return err
}
return nil
}
|
[
"func",
"(",
"c",
"*",
"ContentObj",
")",
"AppendStreamText",
"(",
"text",
"string",
")",
"error",
"{",
"//support only CURRENT_FONT_TYPE_SUBSET",
"textColor",
":=",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"textColor",
"(",
")",
"\n",
"grayFill",
":=",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"grayFill",
"\n",
"fontCountIndex",
":=",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"Font_FontCount",
"+",
"1",
"\n",
"fontSize",
":=",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"Font_Size",
"\n",
"fontStyle",
":=",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"Font_Style",
"\n",
"x",
":=",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"X",
"\n",
"y",
":=",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"Y",
"\n",
"setXCount",
":=",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"setXCount",
"\n",
"fontSubset",
":=",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"Font_ISubset",
"\n\n",
"cache",
":=",
"cacheContentText",
"{",
"fontSubset",
":",
"fontSubset",
",",
"rectangle",
":",
"nil",
",",
"textColor",
":",
"textColor",
",",
"grayFill",
":",
"grayFill",
",",
"fontCountIndex",
":",
"fontCountIndex",
",",
"fontSize",
":",
"fontSize",
",",
"fontStyle",
":",
"fontStyle",
",",
"setXCount",
":",
"setXCount",
",",
"x",
":",
"x",
",",
"y",
":",
"y",
",",
"pageheight",
":",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"pageSize",
".",
"H",
",",
"contentType",
":",
"ContentTypeText",
",",
"lineWidth",
":",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"lineWidth",
",",
"}",
"\n\n",
"var",
"err",
"error",
"\n",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"X",
",",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"Y",
",",
"err",
"=",
"c",
".",
"listCache",
".",
"appendContentText",
"(",
"cache",
",",
"text",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
//AppendStreamText append text
|
[
"AppendStreamText",
"append",
"text"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/content_obj.go#L78-L114
|
8,471 |
signintech/gopdf
|
content_obj.go
|
AppendStreamLine
|
func (c *ContentObj) AppendStreamLine(x1 float64, y1 float64, x2 float64, y2 float64) {
//h := c.getRoot().config.PageSize.H
//c.stream.WriteString(fmt.Sprintf("%0.2f %0.2f m %0.2f %0.2f l s\n", x1, h-y1, x2, h-y2))
var cache cacheContentLine
cache.pageHeight = c.getRoot().curr.pageSize.H
cache.x1 = x1
cache.y1 = y1
cache.x2 = x2
cache.y2 = y2
c.listCache.append(&cache)
}
|
go
|
func (c *ContentObj) AppendStreamLine(x1 float64, y1 float64, x2 float64, y2 float64) {
//h := c.getRoot().config.PageSize.H
//c.stream.WriteString(fmt.Sprintf("%0.2f %0.2f m %0.2f %0.2f l s\n", x1, h-y1, x2, h-y2))
var cache cacheContentLine
cache.pageHeight = c.getRoot().curr.pageSize.H
cache.x1 = x1
cache.y1 = y1
cache.x2 = x2
cache.y2 = y2
c.listCache.append(&cache)
}
|
[
"func",
"(",
"c",
"*",
"ContentObj",
")",
"AppendStreamLine",
"(",
"x1",
"float64",
",",
"y1",
"float64",
",",
"x2",
"float64",
",",
"y2",
"float64",
")",
"{",
"//h := c.getRoot().config.PageSize.H",
"//c.stream.WriteString(fmt.Sprintf(\"%0.2f %0.2f m %0.2f %0.2f l s\\n\", x1, h-y1, x2, h-y2))",
"var",
"cache",
"cacheContentLine",
"\n",
"cache",
".",
"pageHeight",
"=",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"pageSize",
".",
"H",
"\n",
"cache",
".",
"x1",
"=",
"x1",
"\n",
"cache",
".",
"y1",
"=",
"y1",
"\n",
"cache",
".",
"x2",
"=",
"x2",
"\n",
"cache",
".",
"y2",
"=",
"y2",
"\n",
"c",
".",
"listCache",
".",
"append",
"(",
"&",
"cache",
")",
"\n",
"}"
] |
//AppendStreamLine append line
|
[
"AppendStreamLine",
"append",
"line"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/content_obj.go#L154-L164
|
8,472 |
signintech/gopdf
|
content_obj.go
|
AppendStreamOval
|
func (c *ContentObj) AppendStreamOval(x1 float64, y1 float64, x2 float64, y2 float64) {
var cache cacheContentOval
cache.pageHeight = c.getRoot().curr.pageSize.H
cache.x1 = x1
cache.y1 = y1
cache.x2 = x2
cache.y2 = y2
c.listCache.append(&cache)
}
|
go
|
func (c *ContentObj) AppendStreamOval(x1 float64, y1 float64, x2 float64, y2 float64) {
var cache cacheContentOval
cache.pageHeight = c.getRoot().curr.pageSize.H
cache.x1 = x1
cache.y1 = y1
cache.x2 = x2
cache.y2 = y2
c.listCache.append(&cache)
}
|
[
"func",
"(",
"c",
"*",
"ContentObj",
")",
"AppendStreamOval",
"(",
"x1",
"float64",
",",
"y1",
"float64",
",",
"x2",
"float64",
",",
"y2",
"float64",
")",
"{",
"var",
"cache",
"cacheContentOval",
"\n",
"cache",
".",
"pageHeight",
"=",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"pageSize",
".",
"H",
"\n",
"cache",
".",
"x1",
"=",
"x1",
"\n",
"cache",
".",
"y1",
"=",
"y1",
"\n",
"cache",
".",
"x2",
"=",
"x2",
"\n",
"cache",
".",
"y2",
"=",
"y2",
"\n",
"c",
".",
"listCache",
".",
"append",
"(",
"&",
"cache",
")",
"\n",
"}"
] |
//AppendStreamOval append oval
|
[
"AppendStreamOval",
"append",
"oval"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/content_obj.go#L179-L187
|
8,473 |
signintech/gopdf
|
content_obj.go
|
AppendStreamSetGrayFill
|
func (c *ContentObj) AppendStreamSetGrayFill(w float64) {
w = fixRange10(w)
var cache cacheContentGray
cache.grayType = grayTypeFill
cache.scale = w
c.listCache.append(&cache)
}
|
go
|
func (c *ContentObj) AppendStreamSetGrayFill(w float64) {
w = fixRange10(w)
var cache cacheContentGray
cache.grayType = grayTypeFill
cache.scale = w
c.listCache.append(&cache)
}
|
[
"func",
"(",
"c",
"*",
"ContentObj",
")",
"AppendStreamSetGrayFill",
"(",
"w",
"float64",
")",
"{",
"w",
"=",
"fixRange10",
"(",
"w",
")",
"\n",
"var",
"cache",
"cacheContentGray",
"\n",
"cache",
".",
"grayType",
"=",
"grayTypeFill",
"\n",
"cache",
".",
"scale",
"=",
"w",
"\n",
"c",
".",
"listCache",
".",
"append",
"(",
"&",
"cache",
")",
"\n",
"}"
] |
//AppendStreamSetGrayFill set the grayscale fills
|
[
"AppendStreamSetGrayFill",
"set",
"the",
"grayscale",
"fills"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/content_obj.go#L229-L235
|
8,474 |
signintech/gopdf
|
content_obj.go
|
AppendStreamSetGrayStroke
|
func (c *ContentObj) AppendStreamSetGrayStroke(w float64) {
w = fixRange10(w)
var cache cacheContentGray
cache.grayType = grayTypeStroke
cache.scale = w
c.listCache.append(&cache)
}
|
go
|
func (c *ContentObj) AppendStreamSetGrayStroke(w float64) {
w = fixRange10(w)
var cache cacheContentGray
cache.grayType = grayTypeStroke
cache.scale = w
c.listCache.append(&cache)
}
|
[
"func",
"(",
"c",
"*",
"ContentObj",
")",
"AppendStreamSetGrayStroke",
"(",
"w",
"float64",
")",
"{",
"w",
"=",
"fixRange10",
"(",
"w",
")",
"\n",
"var",
"cache",
"cacheContentGray",
"\n",
"cache",
".",
"grayType",
"=",
"grayTypeStroke",
"\n",
"cache",
".",
"scale",
"=",
"w",
"\n",
"c",
".",
"listCache",
".",
"append",
"(",
"&",
"cache",
")",
"\n",
"}"
] |
//AppendStreamSetGrayStroke set the grayscale stroke
|
[
"AppendStreamSetGrayStroke",
"set",
"the",
"grayscale",
"stroke"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/content_obj.go#L238-L244
|
8,475 |
signintech/gopdf
|
content_obj.go
|
AppendStreamSetColorStroke
|
func (c *ContentObj) AppendStreamSetColorStroke(r uint8, g uint8, b uint8) {
var cache cacheContentColor
cache.colorType = colorTypeStroke
cache.r = r
cache.g = g
cache.b = b
c.listCache.append(&cache)
}
|
go
|
func (c *ContentObj) AppendStreamSetColorStroke(r uint8, g uint8, b uint8) {
var cache cacheContentColor
cache.colorType = colorTypeStroke
cache.r = r
cache.g = g
cache.b = b
c.listCache.append(&cache)
}
|
[
"func",
"(",
"c",
"*",
"ContentObj",
")",
"AppendStreamSetColorStroke",
"(",
"r",
"uint8",
",",
"g",
"uint8",
",",
"b",
"uint8",
")",
"{",
"var",
"cache",
"cacheContentColor",
"\n",
"cache",
".",
"colorType",
"=",
"colorTypeStroke",
"\n",
"cache",
".",
"r",
"=",
"r",
"\n",
"cache",
".",
"g",
"=",
"g",
"\n",
"cache",
".",
"b",
"=",
"b",
"\n",
"c",
".",
"listCache",
".",
"append",
"(",
"&",
"cache",
")",
"\n",
"}"
] |
//AppendStreamSetColorStroke set the color stroke
|
[
"AppendStreamSetColorStroke",
"set",
"the",
"color",
"stroke"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/content_obj.go#L247-L254
|
8,476 |
signintech/gopdf
|
content_obj.go
|
AppendStreamSetColorFill
|
func (c *ContentObj) AppendStreamSetColorFill(r uint8, g uint8, b uint8) {
var cache cacheContentColor
cache.colorType = colorTypeFill
cache.r = r
cache.g = g
cache.b = b
c.listCache.append(&cache)
}
|
go
|
func (c *ContentObj) AppendStreamSetColorFill(r uint8, g uint8, b uint8) {
var cache cacheContentColor
cache.colorType = colorTypeFill
cache.r = r
cache.g = g
cache.b = b
c.listCache.append(&cache)
}
|
[
"func",
"(",
"c",
"*",
"ContentObj",
")",
"AppendStreamSetColorFill",
"(",
"r",
"uint8",
",",
"g",
"uint8",
",",
"b",
"uint8",
")",
"{",
"var",
"cache",
"cacheContentColor",
"\n",
"cache",
".",
"colorType",
"=",
"colorTypeFill",
"\n",
"cache",
".",
"r",
"=",
"r",
"\n",
"cache",
".",
"g",
"=",
"g",
"\n",
"cache",
".",
"b",
"=",
"b",
"\n",
"c",
".",
"listCache",
".",
"append",
"(",
"&",
"cache",
")",
"\n",
"}"
] |
//AppendStreamSetColorFill set the color fill
|
[
"AppendStreamSetColorFill",
"set",
"the",
"color",
"fill"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/content_obj.go#L257-L264
|
8,477 |
signintech/gopdf
|
content_obj.go
|
AppendStreamImage
|
func (c *ContentObj) AppendStreamImage(index int, x float64, y float64, rect *Rect) {
//fmt.Printf("index = %d",index)
h := c.getRoot().curr.pageSize.H
var cache cacheContentImage
cache.h = h
cache.x = x
cache.y = y
cache.rect = *rect
cache.index = index
c.listCache.append(&cache)
//c.stream.WriteString(fmt.Sprintf("q %0.2f 0 0 %0.2f %0.2f %0.2f cm /I%d Do Q\n", rect.W, rect.H, x, h-(y+rect.H), index+1))
}
|
go
|
func (c *ContentObj) AppendStreamImage(index int, x float64, y float64, rect *Rect) {
//fmt.Printf("index = %d",index)
h := c.getRoot().curr.pageSize.H
var cache cacheContentImage
cache.h = h
cache.x = x
cache.y = y
cache.rect = *rect
cache.index = index
c.listCache.append(&cache)
//c.stream.WriteString(fmt.Sprintf("q %0.2f 0 0 %0.2f %0.2f %0.2f cm /I%d Do Q\n", rect.W, rect.H, x, h-(y+rect.H), index+1))
}
|
[
"func",
"(",
"c",
"*",
"ContentObj",
")",
"AppendStreamImage",
"(",
"index",
"int",
",",
"x",
"float64",
",",
"y",
"float64",
",",
"rect",
"*",
"Rect",
")",
"{",
"//fmt.Printf(\"index = %d\",index)",
"h",
":=",
"c",
".",
"getRoot",
"(",
")",
".",
"curr",
".",
"pageSize",
".",
"H",
"\n",
"var",
"cache",
"cacheContentImage",
"\n",
"cache",
".",
"h",
"=",
"h",
"\n",
"cache",
".",
"x",
"=",
"x",
"\n",
"cache",
".",
"y",
"=",
"y",
"\n",
"cache",
".",
"rect",
"=",
"*",
"rect",
"\n",
"cache",
".",
"index",
"=",
"index",
"\n",
"c",
".",
"listCache",
".",
"append",
"(",
"&",
"cache",
")",
"\n",
"//c.stream.WriteString(fmt.Sprintf(\"q %0.2f 0 0 %0.2f %0.2f %0.2f cm /I%d Do Q\\n\", rect.W, rect.H, x, h-(y+rect.H), index+1))",
"}"
] |
//AppendStreamImage append image
|
[
"AppendStreamImage",
"append",
"image"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/content_obj.go#L267-L278
|
8,478 |
signintech/gopdf
|
config.go
|
UnitsToPoints
|
func UnitsToPoints(t int, u float64) float64 {
switch t {
case Unit_PT:
return u * conversion_Unit_PT
case Unit_MM:
return u * conversion_Unit_MM
case Unit_CM:
return u * conversion_Unit_CM
case Unit_IN:
return u * conversion_Unit_IN
default:
return u
}
}
|
go
|
func UnitsToPoints(t int, u float64) float64 {
switch t {
case Unit_PT:
return u * conversion_Unit_PT
case Unit_MM:
return u * conversion_Unit_MM
case Unit_CM:
return u * conversion_Unit_CM
case Unit_IN:
return u * conversion_Unit_IN
default:
return u
}
}
|
[
"func",
"UnitsToPoints",
"(",
"t",
"int",
",",
"u",
"float64",
")",
"float64",
"{",
"switch",
"t",
"{",
"case",
"Unit_PT",
":",
"return",
"u",
"*",
"conversion_Unit_PT",
"\n",
"case",
"Unit_MM",
":",
"return",
"u",
"*",
"conversion_Unit_MM",
"\n",
"case",
"Unit_CM",
":",
"return",
"u",
"*",
"conversion_Unit_CM",
"\n",
"case",
"Unit_IN",
":",
"return",
"u",
"*",
"conversion_Unit_IN",
"\n",
"default",
":",
"return",
"u",
"\n",
"}",
"\n",
"}"
] |
// UnitsToPoints converts units of the provided type to points
|
[
"UnitsToPoints",
"converts",
"units",
"of",
"the",
"provided",
"type",
"to",
"points"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/config.go#L35-L48
|
8,479 |
signintech/gopdf
|
config.go
|
UnitsToPointsVar
|
func UnitsToPointsVar(t int, u ...*float64) {
for x := 0; x < len(u); x++ {
*u[x] = UnitsToPoints(t, *u[x])
}
}
|
go
|
func UnitsToPointsVar(t int, u ...*float64) {
for x := 0; x < len(u); x++ {
*u[x] = UnitsToPoints(t, *u[x])
}
}
|
[
"func",
"UnitsToPointsVar",
"(",
"t",
"int",
",",
"u",
"...",
"*",
"float64",
")",
"{",
"for",
"x",
":=",
"0",
";",
"x",
"<",
"len",
"(",
"u",
")",
";",
"x",
"++",
"{",
"*",
"u",
"[",
"x",
"]",
"=",
"UnitsToPoints",
"(",
"t",
",",
"*",
"u",
"[",
"x",
"]",
")",
"\n",
"}",
"\n",
"}"
] |
// UnitsToPointsVar converts units of the provided type to points for all variables supplied
|
[
"UnitsToPointsVar",
"converts",
"units",
"of",
"the",
"provided",
"type",
"to",
"points",
"for",
"all",
"variables",
"supplied"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/config.go#L67-L71
|
8,480 |
signintech/gopdf
|
config.go
|
PointsToUnitsVar
|
func PointsToUnitsVar(t int, u ...*float64) {
for x := 0; x < len(u); x++ {
*u[x] = PointsToUnits(t, *u[x])
}
}
|
go
|
func PointsToUnitsVar(t int, u ...*float64) {
for x := 0; x < len(u); x++ {
*u[x] = PointsToUnits(t, *u[x])
}
}
|
[
"func",
"PointsToUnitsVar",
"(",
"t",
"int",
",",
"u",
"...",
"*",
"float64",
")",
"{",
"for",
"x",
":=",
"0",
";",
"x",
"<",
"len",
"(",
"u",
")",
";",
"x",
"++",
"{",
"*",
"u",
"[",
"x",
"]",
"=",
"PointsToUnits",
"(",
"t",
",",
"*",
"u",
"[",
"x",
"]",
")",
"\n",
"}",
"\n",
"}"
] |
// PointsToUnitsVar converts points to the provided units for all variables supplied
|
[
"PointsToUnitsVar",
"converts",
"points",
"to",
"the",
"provided",
"units",
"for",
"all",
"variables",
"supplied"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/config.go#L74-L78
|
8,481 |
signintech/gopdf
|
procset_obj.go
|
IsContainsFamilyAndStyle
|
func (re *RelateFonts) IsContainsFamilyAndStyle(family string, style int) bool {
i := 0
max := len(*re)
for i < max {
if (*re)[i].Family == family && (*re)[i].Style == style {
return true
}
i++
}
return false
}
|
go
|
func (re *RelateFonts) IsContainsFamilyAndStyle(family string, style int) bool {
i := 0
max := len(*re)
for i < max {
if (*re)[i].Family == family && (*re)[i].Style == style {
return true
}
i++
}
return false
}
|
[
"func",
"(",
"re",
"*",
"RelateFonts",
")",
"IsContainsFamilyAndStyle",
"(",
"family",
"string",
",",
"style",
"int",
")",
"bool",
"{",
"i",
":=",
"0",
"\n",
"max",
":=",
"len",
"(",
"*",
"re",
")",
"\n",
"for",
"i",
"<",
"max",
"{",
"if",
"(",
"*",
"re",
")",
"[",
"i",
"]",
".",
"Family",
"==",
"family",
"&&",
"(",
"*",
"re",
")",
"[",
"i",
"]",
".",
"Style",
"==",
"style",
"{",
"return",
"true",
"\n",
"}",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
// IsContainsFamilyAndStyle - checks if already exists font with same name and style
|
[
"IsContainsFamilyAndStyle",
"-",
"checks",
"if",
"already",
"exists",
"font",
"with",
"same",
"name",
"and",
"style"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/procset_obj.go#L68-L78
|
8,482 |
signintech/gopdf
|
pdf_protection.go
|
SetProtection
|
func (p *PDFProtection) SetProtection(permissions int, userPass []byte, ownerPass []byte) error {
return p.setProtection(permissions, userPass, ownerPass)
}
|
go
|
func (p *PDFProtection) SetProtection(permissions int, userPass []byte, ownerPass []byte) error {
return p.setProtection(permissions, userPass, ownerPass)
}
|
[
"func",
"(",
"p",
"*",
"PDFProtection",
")",
"SetProtection",
"(",
"permissions",
"int",
",",
"userPass",
"[",
"]",
"byte",
",",
"ownerPass",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"p",
".",
"setProtection",
"(",
"permissions",
",",
"userPass",
",",
"ownerPass",
")",
"\n",
"}"
] |
//SetProtection set protection infomation
|
[
"SetProtection",
"set",
"protection",
"infomation"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/pdf_protection.go#L38-L40
|
8,483 |
signintech/gopdf
|
strhelper.go
|
StrHelperGetStringWidth
|
func StrHelperGetStringWidth(str string, fontSize int, ifont IFont) float64 {
w := 0
bs := []byte(str)
i := 0
max := len(bs)
for i < max {
w += ifont.GetCw()[bs[i]]
i++
}
return float64(w) * (float64(fontSize) / 1000.0)
}
|
go
|
func StrHelperGetStringWidth(str string, fontSize int, ifont IFont) float64 {
w := 0
bs := []byte(str)
i := 0
max := len(bs)
for i < max {
w += ifont.GetCw()[bs[i]]
i++
}
return float64(w) * (float64(fontSize) / 1000.0)
}
|
[
"func",
"StrHelperGetStringWidth",
"(",
"str",
"string",
",",
"fontSize",
"int",
",",
"ifont",
"IFont",
")",
"float64",
"{",
"w",
":=",
"0",
"\n",
"bs",
":=",
"[",
"]",
"byte",
"(",
"str",
")",
"\n",
"i",
":=",
"0",
"\n",
"max",
":=",
"len",
"(",
"bs",
")",
"\n",
"for",
"i",
"<",
"max",
"{",
"w",
"+=",
"ifont",
".",
"GetCw",
"(",
")",
"[",
"bs",
"[",
"i",
"]",
"]",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"return",
"float64",
"(",
"w",
")",
"*",
"(",
"float64",
"(",
"fontSize",
")",
"/",
"1000.0",
")",
"\n",
"}"
] |
//StrHelperGetStringWidth get string width
|
[
"StrHelperGetStringWidth",
"get",
"string",
"width"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/strhelper.go#L9-L19
|
8,484 |
signintech/gopdf
|
strhelper.go
|
ReadShortFromByte
|
func ReadShortFromByte(data []byte, offset int) (int64, int) {
buff := data[offset : offset+2]
num := big.NewInt(0)
num.SetBytes(buff)
u := num.Uint64()
var v int64
if u >= 0x8000 {
v = int64(u) - 65536
} else {
v = int64(u)
}
return v, 2
}
|
go
|
func ReadShortFromByte(data []byte, offset int) (int64, int) {
buff := data[offset : offset+2]
num := big.NewInt(0)
num.SetBytes(buff)
u := num.Uint64()
var v int64
if u >= 0x8000 {
v = int64(u) - 65536
} else {
v = int64(u)
}
return v, 2
}
|
[
"func",
"ReadShortFromByte",
"(",
"data",
"[",
"]",
"byte",
",",
"offset",
"int",
")",
"(",
"int64",
",",
"int",
")",
"{",
"buff",
":=",
"data",
"[",
"offset",
":",
"offset",
"+",
"2",
"]",
"\n",
"num",
":=",
"big",
".",
"NewInt",
"(",
"0",
")",
"\n",
"num",
".",
"SetBytes",
"(",
"buff",
")",
"\n",
"u",
":=",
"num",
".",
"Uint64",
"(",
")",
"\n",
"var",
"v",
"int64",
"\n",
"if",
"u",
">=",
"0x8000",
"{",
"v",
"=",
"int64",
"(",
"u",
")",
"-",
"65536",
"\n",
"}",
"else",
"{",
"v",
"=",
"int64",
"(",
"u",
")",
"\n",
"}",
"\n",
"return",
"v",
",",
"2",
"\n",
"}"
] |
//ReadShortFromByte read short from byte array
|
[
"ReadShortFromByte",
"read",
"short",
"from",
"byte",
"array"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/strhelper.go#L29-L41
|
8,485 |
signintech/gopdf
|
strhelper.go
|
ReadUShortFromByte
|
func ReadUShortFromByte(data []byte, offset int) (uint64, int) {
buff := data[offset : offset+2]
num := big.NewInt(0)
num.SetBytes(buff)
return num.Uint64(), 2
}
|
go
|
func ReadUShortFromByte(data []byte, offset int) (uint64, int) {
buff := data[offset : offset+2]
num := big.NewInt(0)
num.SetBytes(buff)
return num.Uint64(), 2
}
|
[
"func",
"ReadUShortFromByte",
"(",
"data",
"[",
"]",
"byte",
",",
"offset",
"int",
")",
"(",
"uint64",
",",
"int",
")",
"{",
"buff",
":=",
"data",
"[",
"offset",
":",
"offset",
"+",
"2",
"]",
"\n",
"num",
":=",
"big",
".",
"NewInt",
"(",
"0",
")",
"\n",
"num",
".",
"SetBytes",
"(",
"buff",
")",
"\n",
"return",
"num",
".",
"Uint64",
"(",
")",
",",
"2",
"\n",
"}"
] |
//ReadUShortFromByte read ushort from byte array
|
[
"ReadUShortFromByte",
"read",
"ushort",
"from",
"byte",
"array"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/strhelper.go#L44-L49
|
8,486 |
signintech/gopdf
|
cache_content_text.go
|
Setup
|
func (c *CacheContent) Setup(rectangle *Rect,
textColor Rgb,
grayFill float64,
fontCountIndex int, //Curr.Font_FontCount+1
fontSize int,
fontStyle int,
setXCount int, //จำนวนครั้งที่ใช้ setX
x, y float64,
fontSubset *SubsetFontObj,
pageheight float64,
contentType int,
cellOpt CellOption,
lineWidth float64,
) {
c.cacheContentText = cacheContentText{
fontSubset: fontSubset,
rectangle: rectangle,
textColor: textColor,
grayFill: grayFill,
fontCountIndex: fontCountIndex,
fontSize: fontSize,
fontStyle: fontStyle,
setXCount: setXCount,
x: x,
y: y,
pageheight: pageheight,
contentType: ContentTypeCell,
cellOpt: cellOpt,
lineWidth: lineWidth,
}
}
|
go
|
func (c *CacheContent) Setup(rectangle *Rect,
textColor Rgb,
grayFill float64,
fontCountIndex int, //Curr.Font_FontCount+1
fontSize int,
fontStyle int,
setXCount int, //จำนวนครั้งที่ใช้ setX
x, y float64,
fontSubset *SubsetFontObj,
pageheight float64,
contentType int,
cellOpt CellOption,
lineWidth float64,
) {
c.cacheContentText = cacheContentText{
fontSubset: fontSubset,
rectangle: rectangle,
textColor: textColor,
grayFill: grayFill,
fontCountIndex: fontCountIndex,
fontSize: fontSize,
fontStyle: fontStyle,
setXCount: setXCount,
x: x,
y: y,
pageheight: pageheight,
contentType: ContentTypeCell,
cellOpt: cellOpt,
lineWidth: lineWidth,
}
}
|
[
"func",
"(",
"c",
"*",
"CacheContent",
")",
"Setup",
"(",
"rectangle",
"*",
"Rect",
",",
"textColor",
"Rgb",
",",
"grayFill",
"float64",
",",
"fontCountIndex",
"int",
",",
"//Curr.Font_FontCount+1",
"fontSize",
"int",
",",
"fontStyle",
"int",
",",
"setXCount",
"int",
",",
"//จำนวนครั้งที่ใช้ setX",
"x",
",",
"y",
"float64",
",",
"fontSubset",
"*",
"SubsetFontObj",
",",
"pageheight",
"float64",
",",
"contentType",
"int",
",",
"cellOpt",
"CellOption",
",",
"lineWidth",
"float64",
",",
")",
"{",
"c",
".",
"cacheContentText",
"=",
"cacheContentText",
"{",
"fontSubset",
":",
"fontSubset",
",",
"rectangle",
":",
"rectangle",
",",
"textColor",
":",
"textColor",
",",
"grayFill",
":",
"grayFill",
",",
"fontCountIndex",
":",
"fontCountIndex",
",",
"fontSize",
":",
"fontSize",
",",
"fontStyle",
":",
"fontStyle",
",",
"setXCount",
":",
"setXCount",
",",
"x",
":",
"x",
",",
"y",
":",
"y",
",",
"pageheight",
":",
"pageheight",
",",
"contentType",
":",
"ContentTypeCell",
",",
"cellOpt",
":",
"cellOpt",
",",
"lineWidth",
":",
"lineWidth",
",",
"}",
"\n",
"}"
] |
//Setup setup all infomation for cacheContent
|
[
"Setup",
"setup",
"all",
"infomation",
"for",
"cacheContent"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/cache_content_text.go#L333-L363
|
8,487 |
signintech/gopdf
|
fontmaker/core/ttfparser.go
|
ParseByReader
|
func (t *TTFParser) ParseByReader(rd io.Reader) error {
return t.parse(rd)
}
|
go
|
func (t *TTFParser) ParseByReader(rd io.Reader) error {
return t.parse(rd)
}
|
[
"func",
"(",
"t",
"*",
"TTFParser",
")",
"ParseByReader",
"(",
"rd",
"io",
".",
"Reader",
")",
"error",
"{",
"return",
"t",
".",
"parse",
"(",
"rd",
")",
"\n",
"}"
] |
//ParseByReader parse by io.reader
|
[
"ParseByReader",
"parse",
"by",
"io",
".",
"reader"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/fontmaker/core/ttfparser.go#L217-L219
|
8,488 |
signintech/gopdf
|
fontmaker/core/ttfparser.go
|
Seek
|
func (t *TTFParser) Seek(fd *bytes.Reader, tag string) error {
table, ok := t.tables[tag]
if !ok {
return ErrTableNotFound
}
val := table.Offset
_, err := fd.Seek(int64(val), 0)
if err != nil {
return err
}
return nil
}
|
go
|
func (t *TTFParser) Seek(fd *bytes.Reader, tag string) error {
table, ok := t.tables[tag]
if !ok {
return ErrTableNotFound
}
val := table.Offset
_, err := fd.Seek(int64(val), 0)
if err != nil {
return err
}
return nil
}
|
[
"func",
"(",
"t",
"*",
"TTFParser",
")",
"Seek",
"(",
"fd",
"*",
"bytes",
".",
"Reader",
",",
"tag",
"string",
")",
"error",
"{",
"table",
",",
"ok",
":=",
"t",
".",
"tables",
"[",
"tag",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"ErrTableNotFound",
"\n",
"}",
"\n",
"val",
":=",
"table",
".",
"Offset",
"\n",
"_",
",",
"err",
":=",
"fd",
".",
"Seek",
"(",
"int64",
"(",
"val",
")",
",",
"0",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
//Seek seek by tag
|
[
"Seek",
"seek",
"by",
"tag"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/fontmaker/core/ttfparser.go#L961-L972
|
8,489 |
signintech/gopdf
|
fontmaker/core/ttfparser.go
|
ReadUShort
|
func (t *TTFParser) ReadUShort(fd *bytes.Reader) (uint, error) {
buff, err := t.Read(fd, 2)
if err != nil {
return 0, err
}
n := binary.BigEndian.Uint16(buff)
return uint(n), nil
}
|
go
|
func (t *TTFParser) ReadUShort(fd *bytes.Reader) (uint, error) {
buff, err := t.Read(fd, 2)
if err != nil {
return 0, err
}
n := binary.BigEndian.Uint16(buff)
return uint(n), nil
}
|
[
"func",
"(",
"t",
"*",
"TTFParser",
")",
"ReadUShort",
"(",
"fd",
"*",
"bytes",
".",
"Reader",
")",
"(",
"uint",
",",
"error",
")",
"{",
"buff",
",",
"err",
":=",
"t",
".",
"Read",
"(",
"fd",
",",
"2",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"n",
":=",
"binary",
".",
"BigEndian",
".",
"Uint16",
"(",
"buff",
")",
"\n",
"return",
"uint",
"(",
"n",
")",
",",
"nil",
"\n",
"}"
] |
//ReadUShort read ushort
|
[
"ReadUShort",
"read",
"ushort"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/fontmaker/core/ttfparser.go#L980-L987
|
8,490 |
signintech/gopdf
|
fontmaker/core/ttfparser.go
|
ReadShort
|
func (t *TTFParser) ReadShort(fd *bytes.Reader) (int, error) {
u, err := t.ReadUShort(fd)
if err != nil {
return 0, err
}
//fmt.Printf("%#v\n", buff)
var v int
if u >= 0x8000 {
v = int(u) - 65536
} else {
v = int(u)
}
return v, nil
}
|
go
|
func (t *TTFParser) ReadShort(fd *bytes.Reader) (int, error) {
u, err := t.ReadUShort(fd)
if err != nil {
return 0, err
}
//fmt.Printf("%#v\n", buff)
var v int
if u >= 0x8000 {
v = int(u) - 65536
} else {
v = int(u)
}
return v, nil
}
|
[
"func",
"(",
"t",
"*",
"TTFParser",
")",
"ReadShort",
"(",
"fd",
"*",
"bytes",
".",
"Reader",
")",
"(",
"int",
",",
"error",
")",
"{",
"u",
",",
"err",
":=",
"t",
".",
"ReadUShort",
"(",
"fd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"//fmt.Printf(\"%#v\\n\", buff)",
"var",
"v",
"int",
"\n",
"if",
"u",
">=",
"0x8000",
"{",
"v",
"=",
"int",
"(",
"u",
")",
"-",
"65536",
"\n",
"}",
"else",
"{",
"v",
"=",
"int",
"(",
"u",
")",
"\n",
"}",
"\n",
"return",
"v",
",",
"nil",
"\n",
"}"
] |
//ReadShort read short
|
[
"ReadShort",
"read",
"short"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/fontmaker/core/ttfparser.go#L990-L1004
|
8,491 |
signintech/gopdf
|
fontmaker/core/ttfparser.go
|
ReadShortInt16
|
func (t *TTFParser) ReadShortInt16(fd *bytes.Reader) (int16, error) {
n, err := t.ReadShort(fd)
if err != nil {
return 0, err
}
return int16(n), nil
}
|
go
|
func (t *TTFParser) ReadShortInt16(fd *bytes.Reader) (int16, error) {
n, err := t.ReadShort(fd)
if err != nil {
return 0, err
}
return int16(n), nil
}
|
[
"func",
"(",
"t",
"*",
"TTFParser",
")",
"ReadShortInt16",
"(",
"fd",
"*",
"bytes",
".",
"Reader",
")",
"(",
"int16",
",",
"error",
")",
"{",
"n",
",",
"err",
":=",
"t",
".",
"ReadShort",
"(",
"fd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"return",
"int16",
"(",
"n",
")",
",",
"nil",
"\n",
"}"
] |
//ReadShortInt16 read short return int16
|
[
"ReadShortInt16",
"read",
"short",
"return",
"int16"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/fontmaker/core/ttfparser.go#L1007-L1013
|
8,492 |
signintech/gopdf
|
fontmaker/core/ttfparser.go
|
ReadULong
|
func (t *TTFParser) ReadULong(fd *bytes.Reader) (uint, error) {
buff, err := t.Read(fd, 4)
//fmt.Printf("%#v\n", buff)
if err != nil {
return 0, err
}
n := binary.BigEndian.Uint32(buff)
return uint(n), nil
}
|
go
|
func (t *TTFParser) ReadULong(fd *bytes.Reader) (uint, error) {
buff, err := t.Read(fd, 4)
//fmt.Printf("%#v\n", buff)
if err != nil {
return 0, err
}
n := binary.BigEndian.Uint32(buff)
return uint(n), nil
}
|
[
"func",
"(",
"t",
"*",
"TTFParser",
")",
"ReadULong",
"(",
"fd",
"*",
"bytes",
".",
"Reader",
")",
"(",
"uint",
",",
"error",
")",
"{",
"buff",
",",
"err",
":=",
"t",
".",
"Read",
"(",
"fd",
",",
"4",
")",
"\n",
"//fmt.Printf(\"%#v\\n\", buff)",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"n",
":=",
"binary",
".",
"BigEndian",
".",
"Uint32",
"(",
"buff",
")",
"\n",
"return",
"uint",
"(",
"n",
")",
",",
"nil",
"\n",
"}"
] |
//ReadULong read ulong
|
[
"ReadULong",
"read",
"ulong"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/fontmaker/core/ttfparser.go#L1016-L1024
|
8,493 |
signintech/gopdf
|
gopdf.go
|
SetGrayFill
|
func (gp *GoPdf) SetGrayFill(grayScale float64) {
gp.curr.grayFill = grayScale
gp.getContent().AppendStreamSetGrayFill(grayScale)
}
|
go
|
func (gp *GoPdf) SetGrayFill(grayScale float64) {
gp.curr.grayFill = grayScale
gp.getContent().AppendStreamSetGrayFill(grayScale)
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"SetGrayFill",
"(",
"grayScale",
"float64",
")",
"{",
"gp",
".",
"curr",
".",
"grayFill",
"=",
"grayScale",
"\n",
"gp",
".",
"getContent",
"(",
")",
".",
"AppendStreamSetGrayFill",
"(",
"grayScale",
")",
"\n",
"}"
] |
//SetGrayFill set the grayscale for the fill, takes a float64 between 0.0 and 1.0
|
[
"SetGrayFill",
"set",
"the",
"grayscale",
"for",
"the",
"fill",
"takes",
"a",
"float64",
"between",
"0",
".",
"0",
"and",
"1",
".",
"0"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/gopdf.go#L159-L162
|
8,494 |
signintech/gopdf
|
gopdf.go
|
SetGrayStroke
|
func (gp *GoPdf) SetGrayStroke(grayScale float64) {
gp.curr.grayStroke = grayScale
gp.getContent().AppendStreamSetGrayStroke(grayScale)
}
|
go
|
func (gp *GoPdf) SetGrayStroke(grayScale float64) {
gp.curr.grayStroke = grayScale
gp.getContent().AppendStreamSetGrayStroke(grayScale)
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"SetGrayStroke",
"(",
"grayScale",
"float64",
")",
"{",
"gp",
".",
"curr",
".",
"grayStroke",
"=",
"grayScale",
"\n",
"gp",
".",
"getContent",
"(",
")",
".",
"AppendStreamSetGrayStroke",
"(",
"grayScale",
")",
"\n",
"}"
] |
//SetGrayStroke set the grayscale for the stroke, takes a float64 between 0.0 and 1.0
|
[
"SetGrayStroke",
"set",
"the",
"grayscale",
"for",
"the",
"stroke",
"takes",
"a",
"float64",
"between",
"0",
".",
"0",
"and",
"1",
".",
"0"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/gopdf.go#L165-L168
|
8,495 |
signintech/gopdf
|
gopdf.go
|
AddTTFFontByReader
|
func (gp *GoPdf) AddTTFFontByReader(family string, rd io.Reader) error {
return gp.AddTTFFontByReaderWithOption(family, rd, defaultTtfFontOption())
}
|
go
|
func (gp *GoPdf) AddTTFFontByReader(family string, rd io.Reader) error {
return gp.AddTTFFontByReaderWithOption(family, rd, defaultTtfFontOption())
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"AddTTFFontByReader",
"(",
"family",
"string",
",",
"rd",
"io",
".",
"Reader",
")",
"error",
"{",
"return",
"gp",
".",
"AddTTFFontByReaderWithOption",
"(",
"family",
",",
"rd",
",",
"defaultTtfFontOption",
"(",
")",
")",
"\n",
"}"
] |
//AddTTFFontByReader add font file
|
[
"AddTTFFontByReader",
"add",
"font",
"file"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/gopdf.go#L595-L597
|
8,496 |
signintech/gopdf
|
gopdf.go
|
AddTTFFontByReaderWithOption
|
func (gp *GoPdf) AddTTFFontByReaderWithOption(family string, rd io.Reader, option TtfOption) error {
subsetFont := new(SubsetFontObj)
subsetFont.init(func() *GoPdf {
return gp
})
subsetFont.SetTtfFontOption(option)
subsetFont.SetFamily(family)
err := subsetFont.SetTTFByReader(rd)
if err != nil {
return err
}
unicodemap := new(UnicodeMap)
unicodemap.init(func() *GoPdf {
return gp
})
unicodemap.setProtection(gp.protection())
unicodemap.SetPtrToSubsetFontObj(subsetFont)
unicodeindex := gp.addObj(unicodemap)
pdfdic := new(PdfDictionaryObj)
pdfdic.init(func() *GoPdf {
return gp
})
pdfdic.setProtection(gp.protection())
pdfdic.SetPtrToSubsetFontObj(subsetFont)
pdfdicindex := gp.addObj(pdfdic)
subfontdesc := new(SubfontDescriptorObj)
subfontdesc.init(func() *GoPdf {
return gp
})
subfontdesc.SetPtrToSubsetFontObj(subsetFont)
subfontdesc.SetIndexObjPdfDictionary(pdfdicindex)
subfontdescindex := gp.addObj(subfontdesc)
cidfont := new(CIDFontObj)
cidfont.init(func() *GoPdf {
return gp
})
cidfont.SetPtrToSubsetFontObj(subsetFont)
cidfont.SetIndexObjSubfontDescriptor(subfontdescindex)
cidindex := gp.addObj(cidfont)
subsetFont.SetIndexObjCIDFont(cidindex)
subsetFont.SetIndexObjUnicodeMap(unicodeindex)
index := gp.addObj(subsetFont) //add หลังสุด
if gp.indexOfProcSet != -1 {
procset := gp.pdfObjs[gp.indexOfProcSet].(*ProcSetObj)
if !procset.Realtes.IsContainsFamilyAndStyle(family, option.Style&^Underline) {
procset.Realtes = append(procset.Realtes, RelateFont{Family: family, IndexOfObj: index, CountOfFont: gp.curr.CountOfFont, Style: option.Style &^ Underline})
subsetFont.CountOfFont = gp.curr.CountOfFont
gp.curr.CountOfFont++
}
}
return nil
}
|
go
|
func (gp *GoPdf) AddTTFFontByReaderWithOption(family string, rd io.Reader, option TtfOption) error {
subsetFont := new(SubsetFontObj)
subsetFont.init(func() *GoPdf {
return gp
})
subsetFont.SetTtfFontOption(option)
subsetFont.SetFamily(family)
err := subsetFont.SetTTFByReader(rd)
if err != nil {
return err
}
unicodemap := new(UnicodeMap)
unicodemap.init(func() *GoPdf {
return gp
})
unicodemap.setProtection(gp.protection())
unicodemap.SetPtrToSubsetFontObj(subsetFont)
unicodeindex := gp.addObj(unicodemap)
pdfdic := new(PdfDictionaryObj)
pdfdic.init(func() *GoPdf {
return gp
})
pdfdic.setProtection(gp.protection())
pdfdic.SetPtrToSubsetFontObj(subsetFont)
pdfdicindex := gp.addObj(pdfdic)
subfontdesc := new(SubfontDescriptorObj)
subfontdesc.init(func() *GoPdf {
return gp
})
subfontdesc.SetPtrToSubsetFontObj(subsetFont)
subfontdesc.SetIndexObjPdfDictionary(pdfdicindex)
subfontdescindex := gp.addObj(subfontdesc)
cidfont := new(CIDFontObj)
cidfont.init(func() *GoPdf {
return gp
})
cidfont.SetPtrToSubsetFontObj(subsetFont)
cidfont.SetIndexObjSubfontDescriptor(subfontdescindex)
cidindex := gp.addObj(cidfont)
subsetFont.SetIndexObjCIDFont(cidindex)
subsetFont.SetIndexObjUnicodeMap(unicodeindex)
index := gp.addObj(subsetFont) //add หลังสุด
if gp.indexOfProcSet != -1 {
procset := gp.pdfObjs[gp.indexOfProcSet].(*ProcSetObj)
if !procset.Realtes.IsContainsFamilyAndStyle(family, option.Style&^Underline) {
procset.Realtes = append(procset.Realtes, RelateFont{Family: family, IndexOfObj: index, CountOfFont: gp.curr.CountOfFont, Style: option.Style &^ Underline})
subsetFont.CountOfFont = gp.curr.CountOfFont
gp.curr.CountOfFont++
}
}
return nil
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"AddTTFFontByReaderWithOption",
"(",
"family",
"string",
",",
"rd",
"io",
".",
"Reader",
",",
"option",
"TtfOption",
")",
"error",
"{",
"subsetFont",
":=",
"new",
"(",
"SubsetFontObj",
")",
"\n",
"subsetFont",
".",
"init",
"(",
"func",
"(",
")",
"*",
"GoPdf",
"{",
"return",
"gp",
"\n",
"}",
")",
"\n",
"subsetFont",
".",
"SetTtfFontOption",
"(",
"option",
")",
"\n",
"subsetFont",
".",
"SetFamily",
"(",
"family",
")",
"\n",
"err",
":=",
"subsetFont",
".",
"SetTTFByReader",
"(",
"rd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"unicodemap",
":=",
"new",
"(",
"UnicodeMap",
")",
"\n",
"unicodemap",
".",
"init",
"(",
"func",
"(",
")",
"*",
"GoPdf",
"{",
"return",
"gp",
"\n",
"}",
")",
"\n",
"unicodemap",
".",
"setProtection",
"(",
"gp",
".",
"protection",
"(",
")",
")",
"\n",
"unicodemap",
".",
"SetPtrToSubsetFontObj",
"(",
"subsetFont",
")",
"\n",
"unicodeindex",
":=",
"gp",
".",
"addObj",
"(",
"unicodemap",
")",
"\n\n",
"pdfdic",
":=",
"new",
"(",
"PdfDictionaryObj",
")",
"\n",
"pdfdic",
".",
"init",
"(",
"func",
"(",
")",
"*",
"GoPdf",
"{",
"return",
"gp",
"\n",
"}",
")",
"\n",
"pdfdic",
".",
"setProtection",
"(",
"gp",
".",
"protection",
"(",
")",
")",
"\n",
"pdfdic",
".",
"SetPtrToSubsetFontObj",
"(",
"subsetFont",
")",
"\n",
"pdfdicindex",
":=",
"gp",
".",
"addObj",
"(",
"pdfdic",
")",
"\n\n",
"subfontdesc",
":=",
"new",
"(",
"SubfontDescriptorObj",
")",
"\n",
"subfontdesc",
".",
"init",
"(",
"func",
"(",
")",
"*",
"GoPdf",
"{",
"return",
"gp",
"\n",
"}",
")",
"\n",
"subfontdesc",
".",
"SetPtrToSubsetFontObj",
"(",
"subsetFont",
")",
"\n",
"subfontdesc",
".",
"SetIndexObjPdfDictionary",
"(",
"pdfdicindex",
")",
"\n",
"subfontdescindex",
":=",
"gp",
".",
"addObj",
"(",
"subfontdesc",
")",
"\n\n",
"cidfont",
":=",
"new",
"(",
"CIDFontObj",
")",
"\n",
"cidfont",
".",
"init",
"(",
"func",
"(",
")",
"*",
"GoPdf",
"{",
"return",
"gp",
"\n",
"}",
")",
"\n",
"cidfont",
".",
"SetPtrToSubsetFontObj",
"(",
"subsetFont",
")",
"\n",
"cidfont",
".",
"SetIndexObjSubfontDescriptor",
"(",
"subfontdescindex",
")",
"\n",
"cidindex",
":=",
"gp",
".",
"addObj",
"(",
"cidfont",
")",
"\n\n",
"subsetFont",
".",
"SetIndexObjCIDFont",
"(",
"cidindex",
")",
"\n",
"subsetFont",
".",
"SetIndexObjUnicodeMap",
"(",
"unicodeindex",
")",
"\n",
"index",
":=",
"gp",
".",
"addObj",
"(",
"subsetFont",
")",
"//add หลังสุด",
"\n\n",
"if",
"gp",
".",
"indexOfProcSet",
"!=",
"-",
"1",
"{",
"procset",
":=",
"gp",
".",
"pdfObjs",
"[",
"gp",
".",
"indexOfProcSet",
"]",
".",
"(",
"*",
"ProcSetObj",
")",
"\n",
"if",
"!",
"procset",
".",
"Realtes",
".",
"IsContainsFamilyAndStyle",
"(",
"family",
",",
"option",
".",
"Style",
"&^",
"Underline",
")",
"{",
"procset",
".",
"Realtes",
"=",
"append",
"(",
"procset",
".",
"Realtes",
",",
"RelateFont",
"{",
"Family",
":",
"family",
",",
"IndexOfObj",
":",
"index",
",",
"CountOfFont",
":",
"gp",
".",
"curr",
".",
"CountOfFont",
",",
"Style",
":",
"option",
".",
"Style",
"&^",
"Underline",
"}",
")",
"\n",
"subsetFont",
".",
"CountOfFont",
"=",
"gp",
".",
"curr",
".",
"CountOfFont",
"\n",
"gp",
".",
"curr",
".",
"CountOfFont",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
//AddTTFFontByReaderWithOption add font file
|
[
"AddTTFFontByReaderWithOption",
"add",
"font",
"file"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/gopdf.go#L600-L657
|
8,497 |
signintech/gopdf
|
gopdf.go
|
KernOverride
|
func (gp *GoPdf) KernOverride(family string, fn FuncKernOverride) error {
i := 0
max := len(gp.pdfObjs)
for i < max {
if gp.pdfObjs[i].getType() == subsetFont {
obj := gp.pdfObjs[i]
sub, ok := obj.(*SubsetFontObj)
if ok {
if sub.GetFamily() == family {
sub.funcKernOverride = fn
return nil
}
}
}
i++
}
return errors.New("font family not found")
}
|
go
|
func (gp *GoPdf) KernOverride(family string, fn FuncKernOverride) error {
i := 0
max := len(gp.pdfObjs)
for i < max {
if gp.pdfObjs[i].getType() == subsetFont {
obj := gp.pdfObjs[i]
sub, ok := obj.(*SubsetFontObj)
if ok {
if sub.GetFamily() == family {
sub.funcKernOverride = fn
return nil
}
}
}
i++
}
return errors.New("font family not found")
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"KernOverride",
"(",
"family",
"string",
",",
"fn",
"FuncKernOverride",
")",
"error",
"{",
"i",
":=",
"0",
"\n",
"max",
":=",
"len",
"(",
"gp",
".",
"pdfObjs",
")",
"\n",
"for",
"i",
"<",
"max",
"{",
"if",
"gp",
".",
"pdfObjs",
"[",
"i",
"]",
".",
"getType",
"(",
")",
"==",
"subsetFont",
"{",
"obj",
":=",
"gp",
".",
"pdfObjs",
"[",
"i",
"]",
"\n",
"sub",
",",
"ok",
":=",
"obj",
".",
"(",
"*",
"SubsetFontObj",
")",
"\n",
"if",
"ok",
"{",
"if",
"sub",
".",
"GetFamily",
"(",
")",
"==",
"family",
"{",
"sub",
".",
"funcKernOverride",
"=",
"fn",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
//KernOverride override kern value
|
[
"KernOverride",
"override",
"kern",
"value"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/gopdf.go#L679-L696
|
8,498 |
signintech/gopdf
|
gopdf.go
|
SetStrokeColor
|
func (gp *GoPdf) SetStrokeColor(r uint8, g uint8, b uint8) {
gp.getContent().AppendStreamSetColorStroke(r, g, b)
}
|
go
|
func (gp *GoPdf) SetStrokeColor(r uint8, g uint8, b uint8) {
gp.getContent().AppendStreamSetColorStroke(r, g, b)
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"SetStrokeColor",
"(",
"r",
"uint8",
",",
"g",
"uint8",
",",
"b",
"uint8",
")",
"{",
"gp",
".",
"getContent",
"(",
")",
".",
"AppendStreamSetColorStroke",
"(",
"r",
",",
"g",
",",
"b",
")",
"\n",
"}"
] |
//SetStrokeColor set the color for the stroke
|
[
"SetStrokeColor",
"set",
"the",
"color",
"for",
"the",
"stroke"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/gopdf.go#L709-L711
|
8,499 |
signintech/gopdf
|
gopdf.go
|
SetFillColor
|
func (gp *GoPdf) SetFillColor(r uint8, g uint8, b uint8) {
gp.getContent().AppendStreamSetColorFill(r, g, b)
}
|
go
|
func (gp *GoPdf) SetFillColor(r uint8, g uint8, b uint8) {
gp.getContent().AppendStreamSetColorFill(r, g, b)
}
|
[
"func",
"(",
"gp",
"*",
"GoPdf",
")",
"SetFillColor",
"(",
"r",
"uint8",
",",
"g",
"uint8",
",",
"b",
"uint8",
")",
"{",
"gp",
".",
"getContent",
"(",
")",
".",
"AppendStreamSetColorFill",
"(",
"r",
",",
"g",
",",
"b",
")",
"\n",
"}"
] |
//SetFillColor set the color for the stroke
|
[
"SetFillColor",
"set",
"the",
"color",
"for",
"the",
"stroke"
] |
5ddacf37801c86c59455989062fad631835b7583
|
https://github.com/signintech/gopdf/blob/5ddacf37801c86c59455989062fad631835b7583/gopdf.go#L714-L716
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.